mysql双向同步 弊端,[同步]mysql双向同步

条件

服务器1(CentOS6.0x32 Mysql5.5.18)

IP: 192.168.1.2

服务器2(CentOS6.0x64 Mysql5.5.18)

IP: 192.168.1.3

修改配置文件

修改 服务器2 上的/etc/my.cnf文件server-id=2

重启mysqlservice mysqld restart

启动

以下都是进入mysql后,执行的语句:#服务器1 上执行

grant select,replication slave on *.* to 'sync'@'192.168.1.3' identified by 'your password';

flush privileges;

show master status;

#记下File和Position的值 log1

#服务器2 上执行

grant select,replication slave on *.* to 'sync'@'192.168.1.2' identified by 'your password';

flush privileges;

show master status;

#记下File和Position的值 log2

#服务器1 上执行(问号分别替换为刚才log2里面记下的两个值)

change master to master_host='192.168.1.3',master_user='sync', master_password='your password', master_log_file='?', master_log_pos=?;

SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

slave start;

show slave status;

#服务器2 上执行(问号分别替换为刚才log1里面记下的两个值)

change master to master_host='192.168.1.2',master_user='sync', master_password='your password', master_log_file='?', master_log_pos=?;

SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

slave start;

show slave status;

于是,同步就搞定了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值