阿里云RDS for MySQL备份文件+binlog恢复过程中碰到的一些问题
1.一开始通过官方下载有的压缩包安装,碰到各种依赖问题,最后采用YUM安装
1.通过yum安装percona-Xtrabackup
1.1 先安装依赖:
yum install perl-DBI yum install perl-DBD-MySQL yum install perl-Time-HiRes yum install perl-IO-Socket-SSL
1.2 配置yum源
创建文件/etc/yum.repos.d/Percona.repo内容如下:
[percona] name = CentOS $releasever - Percona baseurl=http://repo.percona.com/centos/$releasever/os/$basearch/ enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-percona gpgcheck = 1
获取和保存key
#wget http://www.percona.com/redir/downloads/percona-release/RPM-GPG-KEY-percona #cp RPM-GPG-KEY-percona /etc/pki/rpm-gpg/RPM-GPG-KEY-percona
1.3 安装 percona xtrabackup
下面我们就可以安装percona一系列工具了:
安装xtrabackup #yum -y install percona-xtrabackup 安装toolkit #yum -y install percona-toolkit
===============================================
2.mysqlbinlog 恢复时遇到错误
/usr/local/mysql/bin/mysqlbinlog --start-position=57424350 --stop-position=136098437 mysql-bin.000010 | mysql -uroot -p
Enter password:
ERROR 1781 (HY000) at line 14: @@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF.
解决办法,修改my.cnf
[mysqld]
#log-bin=mysql-bin
gtid_mode=on
enforce_gtid_consistency=on
server_id=2003306 #每天实例的server_id都要不一样
#binlog
log-bin=mysqlbin
log-slave-updates=1 #允许下端接入slave
binlog_format=row #强烈建议,其他格式可能造成数据不一致
#
# #relay log
skip_slave_start=1