天天看点

mysql主主

server1,server2

grant replication slave on *.* to 'backup'@'192.168.1.%' identified by '123456';

flush privileges;

server1

server-id = 1 

log-bin = /data0/mysql/3306/binlog/binlog

binlog-do-db = test

binlog-ignore-db = mysql

log-slave-updates

sync_binlog=1

auto_increment_offset = 1

auto_increment_increment = 2

replicate-do-db = test

replicate-ignore-db = mysql,information_schema

server2

server-id = 2

sync_binlog = 1

auto_increment_offset = 2

/data0/mysql/3306/mysql restart

stop slave;

flush tables with read lock;

show master status;

unlock tables;

change master to master_host='192.168.1.201', master_user='backup', master_password='123456', master_log_file='binlog.000002', master_log_pos=107;

change master to master_host='192.168.1.202', master_user='backup', master_password='123456', master_log_file='binlog.000002', master_log_pos=107;

server1 server2

start slave;

show slave status\G;

继续阅读