xtrabackup(小问题)
前情提要:
利用xtrabackup进行MySQL的单库的热迁移操作。
OS为Ubuntu 16.04,MySQL版本号均为5.7.24
操作流程:
主服务器
==>innobackupex --user=root --password=‘PASSWORD‘ --include=DATABASE PATH ##文件存放位置
==>将文件传输至备机
(ubuntu要注意文件的权限和属主)
备服务器
==>mysql -uroot -pPASSWORD ##登陆数据库
mysql>drop database DATABASE; ##删除原本存在的库
mysql>quit
==>sudo service mysql stop ###停止服务
==>innobackupex --apply-log --redo-only PATH ##备份文件存放目录
==>innobackupex --apply-log --export PATH ##同上
==>cp -rf PATH(备份文件存放目录) /var/lib/mysql/(MySQL数据目录) ##进行复制或者mv剪切
==>chown -R mysql:mysql /var/lib/mysql ## 更改MySQL数据目录文件的属主和属组
==> sudo service mysql start
问题
启动服务失败
查看日志得到如下结论:
2018-12-15T06:34:25.754822Z 0 [ERROR] InnoDB: Log block 290168380 at lsn 148566210048 has valid header, but checksum field contains 1227186396, should be 2689404495
2018-12-15T06:34:25.754834Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 148566210191 and the end 148566210048.
2018-12-15T06:34:25.754841Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-12-15T06:34:26.355474Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-12-15T06:34:26.355507Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-12-15T06:34:26.355518Z 0 [ERROR] Failed to initialize builtin plugins.
2018-12-15T06:34:26.355525Z 0 [ERROR] Aborting
解决
再MySQL配置文件中添加:
innodb_log_checksums = ON
==>sudo rm -f /var/lib/mysql/ib_logfile*
重启MySQL服务成功