Mysql 环形复制

三台主机: 192.168.0.205, 192.168.0.206,192.168.0.207

配置192.168.0.205
 1.edit /etc/mysql/my.cnf
          [mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=1
     2.sudo service mysql restart
     3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
     4.show master status\G;
            File:  mysql-bin.000003
            Position:  4049

配置192.168.0.206
 1.edit /etc/mysql/my.cnf
          [mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=2
     2.sudo service mysql restart
     3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
     4. execute mysql scripts:
          1) stop slave;
          2) change master to master_host='192.168.0.205', master_user='repl',  master_password='slavepass', master_log_file=' mysql-bin.000003',  master_log_pos= 4049;
          3) start slave;
     5.show master status\G;
            File:  mysql-bin.000001
            Position:  1142

     
配置192.168.0.207
 1.edit /etc/mysql/my.cnf
          [mysqld]
log-bin=mysql-bin
server-id=5
binlog-do-db=test
binlog-ignore-db=information_schema,performance_schema,mysql
replicate-do-db=test
replicate-ignore-db=information_schema,performance_schema,mysql
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=3
auto_increment_offset=3
     2.sudo service mysql restart
     3.create user 'repl'@'%' identified by 'slavepass'; grant replication slave on *.* to 'repl'@'%';
     4. execute mysql scripts:
          1) stop slave;
          2) change master to master_host='192.168.0.206', master_user='repl',  master_password='slavepass', master_log_file=' mysql-bin.000001',  master_log_pos= 1142;
          3) start slave;
     5.show master status\G;
            File:  mysql-bin.000002
            Position:  1234

配置192.168.0.205
     1. execute mysql scripts:
          1) stop slave;
          2) change master to master_host='192.168.0.207', master_user='repl',  master_password='slavepass', master_log_file=' mysql-bin.000002',  master_log_pos= 1234;
          3) start slave;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值