查看对端log bin日志和pos值位置
Master配置
1 2 3 4 5 6 7 8 9 10 11 12 13
| mysql>>>
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'172.12.1.%' IDENTIFIED BY 'replication';
change master to master_host='172.12.1.200', master_user='replication', master_password='replication', master_log_file='mysql-bin.000001', master_log_pos=496; #对端状态显示的值
start slave; #启动同步 show slave status \G;
|
slave配置
1 2 3 4 5 6 7 8 9 10 11
| GRANT REPLICATION SLAVE ON *.* TO 'replication'@'172.12.1.%' IDENTIFIED BY 'replication';
change master to master_host='172.12.1.100', master_user='replication', master_password='replication', master_log_file='mysql-bin.000001', master_log_pos=496; #对端状态显示的值
start slave; #启动同步 show slave status \G;
|
主主同步配置完毕,查看同步状态Slave_IO和Slave_SQL是YES说明主主同步成功。
1
| GRANT REPLICATION SLAVE ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
|
搭建keeplived
清除slave状态