Mysql 双主架构配置从复制

时间:2021-03-28 16:27:51

引用自:https://blog.csdn.net/deeplearnings/article/details/78398526

    https://www.cnblogs.com/ygqygq2/p/6045279.html

注:

一、同步技巧  

  若master二进制文件已经存在mysql-bin.000001到mysql-bin.000003三个,也可从mysql-bin.000001任意position开始同步

  change master to master_host='192.168.0.153',master_user='py_rsync_155',master_password='py!@123',master_log_file='mysql-bin.000746',master_log_pos=106,master_port=3306;

二、在my.cnf中特别参数说明

log-slave-updates = true     #将复制事件写入binlog,一台服务器既做主库又做从库此选项必须要开启
#masterA自增长ID
auto_increment_offset = 1
auto_increment_increment = 2 #奇数ID
#masterB自增加ID
auto_increment_offset = 2
auto_increment_increment = 2