|
双向replication的制作:(CP文件方法相同,相異之處如下)
A:10.167.26.1
B:10.167.26.2
1. 分別在A/B都GRANT一個進行replication的用戶:
[A] mysql > GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO rep1@10.167.26.1 IDENTIFIED BY ‘xiaowu’;
mysql > GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO [email=rep1@[/B]10.167.26.2]rep1@10.167.26.2[/email] IDENTIFIED BY ‘xiaowu’;
2. 修改my.cnf文件:
Server A:
server-id = 1
log-bin
sql-bin-update-same
binlog-do-db = mysql
binlog-do-db = test1
binlog-do-db = test2
master-host = 10.167.26.1
master-user=rep1
master-password=xiaowu
log-Slave-updates
master-connect-retry=60
replicate-do-db=mysql
replicate-do-db=test1
replicate-do-db=test2
Server B:
server-id = 2
log-bin
sql-bin-update-same
binlog-do-db = mysql
binlog-do-db = test1
binlog-do-db = test2
master-host = 10.167.26.2
master-user=rep1
master-password=xiaowu
log-Slave-updates
master-connect-retry=60
replicate-do-db=mysql
replicate-do-db=test1
replicate-do-db=test2
开启动DB注意:先启动A,再启动B,再restart A. |
|