前言
- percona-xtrabackup2.x版本支持mysql5
- percona-xtrabackup8.x版本支持mysql8
- mysql5.7.38,系统centos7
安装
# 查看是否安装
rpm -qa | grep -i 'mysql-community'
rpm -qa | grep -i 'percona-xtrabackup'
rpm -ivh mysql-community-common-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.38-1.el7.x86_64.rpm
# 解决安装percona-xtrabackup-24时/etc/my.cnf冲突
rpm -ivh mysql-community-libs-compat-5.7.38-1.el7.x86_64.rpm
yum install percona-xtrabackup-24.x86_64
innobackupex使用
# 备份文件到/backup目录
mkdir /backup
innobackupex --defaults-file=/etc/my.cnf --user=root --password='root' /backup/
# 停止mysql服务,备份原有文件
service mysqld stop
mkdir /var/lib/mysqlbak
mv /var/lib/mysql/* /var/lib/mysqlbak
# 恢复步骤一
innobackupex --defaults-file=/etc/my.cnf --user=root --password='root' --apply-log /backup/2022-04-03_21-01-06/
# 恢复步骤二
innobackupex --defaults-file=/etc/my.cnf --user=root --password='root' --copy-back /backup/2022-04-03_21-01-06/
# 恢复步骤三
chown -R mysql:mysql /var/lib/mysql
# 增量备份
innobackupex --defaults-file=/etc/my.cnf --user=root --password='root' --incremental-basedir=/backup/2022-04-03_21-01-06/ --incremental /backup1/
- https://www.cnblogs.com/zoer/p/12996801.html
- https://blog.51cto.com/hsbxxl/2107388
- https://blog.csdn.net/weixin_33749131/article/details/92824699
- https://www.cnblogs.com/xzy-xin/p/15583789.html