linux 下 mysql 环形数据库的配置
1.192.168.1.102(A主机) 和192.168.1.103 (B主机)
修改A(server_id = 1) 和 B(server_id = 2) [ A 与 B 的server_id 不一样] 的my.cnf
server-id = x[1/2]
log-bin=mysql-bin
log-slave-updates=1
slave-skip-errors=all
replicate_do_db = test
2. 首先在主MySQL节点上,为slave创建一个用户:然后在设置配置的文件名称 和 节点位置
a. grant replication slave,replication client on *.* to root@'192.168.1.103' identified by 'root';
b. stop slave;
c. change master to master_host ='192.168.1.103', master_user = 'root', master_password = 'root', master_log_file = 'mysql-bin.000001', master_log_pos = 106;
d . start slave;
3. 192.168.1.103 重复步骤2配置 192.168.1.103 ==>192.168.1.102
4. 查看配置是否成功
show slave status;
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
为 配置成功