relay_log_purge = 1
relay_log_recovery = 1
这两个是启用relaylog的自动修复功能,避免由于网络之类的外因造成日志损坏,主从停止。
master_info_repository = TABLE
relay_log_info_repository = TABLE
这两个参数会将master.info和relay.info保存在表中,默认是Myisam引擎,官方建议用
alter table slave_master_info engine=innodb;
alter table slave_relay_log_info engine=innodb;
alter table slave_worker_info engine=innodb;
改为Innodb引擎,防止表损坏后自行修复。
3.在my.cnf中设置
relay_log_info_repository = TABLE
master_info_repository = TABLE
relay_log_recovery = on
mysql> show variables like '%relay_log_info_repository%';
+---------------------------+-------+
| Variable_name | Value |
+---------------------------+-------+
| relay_log_info_repository | FILE |
+---------------------------+-------+
1 row in set (0.00 sec)
mysql> show variables like '%master_info_repository%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| master_info_repository | FILE |
+------------------------+-------+
1 row in set (0.00 sec)
mysql> desc mysql.slave_master_info