xtrabackup加密备份
xtrabackup加密备份
生成秘钥
openssl rand -base64 24
MOERPHNbWQ4FifkF85nc7UxAZLu1SfR+
加密备份
xtrabackup --user=root --password=password --backup --compress --compress-threads=4 --encrypt=AES256 --encrypt-key="MOERPHNbWQ4FifkF85nc7UxAZLu1SfR+" --target-dir=/data/beifen/xtra_full_
date +%Y%m%d%H%M%S;
解密解压
--remove-original选项在解密后删除加密文件
trabackup --decompress --parallel=4 --decrypt=AES256 --encrypt-key="MOERPHNbWQ4FifkF85nc7UxAZLu1SfR+" --target-dir=/data/beifencs/xtra_full_20221129171842/ --remove-original
准备
xtrabackup --prepare --target-dir=/data/beifencs/xtra_full_20221129171842/
恢复
xtrabackup --host=127.0.0.1 --user=root --password=password --port=3306 --datadir=/data/mysql/ --copy-back --target-dir=/data/beifencs/xtra_full_20221129171842/