xtrabackup 备份语句:
fname=`date +%F_%H-%M-%S`
mkdir -p /mnt/dbbak/db_$fname
xtrabackup --defaults-file=/etc/my.cnf -uhyb -phd -h/var/lib/mysql -S/var/lib/mysql/mysql.sock -Hlocalhost --port=3306 --backup --parallel=4 --target-dir=/mnt/dbbak/db_$fname
find /mnt/dbbak/ -name "db_*" -type f -mtime +7 -exec rm -rf {} \; > /dev/null 2>&1
还原:
--回滚日志
xtrabackup --prepare --target-dir=/opt/db_2019-10-25_01-54-08/