xtrabackup备份rds记录
在执行最后一步时
mysqld_safe --defaults-file=/home/mysql/data/backup-my.cnf --user=mysql --datadir=/home/mysql/data &
总是提示:
Could not open required defaults file: /home/mysql/data/backup-my.cnf
Fatal error in defaults handling. Program aborted
检查目录/home/mysql/data/及其子目录和文件都是mysql:mysql用户组,backup-my.cnf文件是644权限,想不出问题在哪。dmesg | grep mysqld
命令发现相关错误日志:
[3974514.406548] type=1400 audit(1483503661.006:33): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/mysql/data/backup-my.cnf" pid=27278 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=105
发现是apparmor问题。修改配置文件/etc/apparmor.d/usr.sbin.mysqld,加入一行:
/home/mysql/data/** rw,
再次启动,出现如下错误日志:
[4077561.487273] type=1400 audit(1483606708.085:524): apparmor="DENIED" operation="file_lock" profile="/usr/sbin/mysqld" name="/home/mysql/data/ibdata1" pid=9368 comm="mysqld" requested_mask="k" denied_mask="k" fsuid=105 ouid=105
所以是刚才的/etc/apparmor.d/usr.sbin.mysqld文件修改不彻底,修改如下:
/home/mysql/data/** rwk,
启动成功。
在backup-my.cnf中有几行要注释掉,因为本地mysql5.6不能识别这些参数:
innodb_log_checksum_algorithm=innodb
rds_encrypt_data=false
innodb_encrypt_algorithm=aes_128_ecb
在做增量备份时,会出现如下错误
impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT.
或者
@@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF.
的错的话,在backup-my.cnf中加入如下:
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates = 1
log-bin = binlog
binlog_format=mixed