开发者

MySql - Two slave database replication

开发者 https://www.devze.com 2023-04-11 17:17 出处:网络
I want to achieve same server replication, such a way there will be two databases replicating one database on same server

I want to achieve same server replication, such a way there will be two databases replicating one database on same server

Here is my configuration in my.ini

enter code here


server-id=1

log-bin

report-host=master-is-slave-host
log-bin=localhost-binlog  
relay-log=localhost-relaylog

replicate-same-server-id=1

binlog-do-db=test
replicate-rewrite-db=test->myslave

**#replicate-rewrite-db=test->myslave2 does not work**

 replicate-do-table=myslave.tblslave

**#replicate-do-table=myslave2.tblslave does not work**

the above code works fine for replication from db test to myslave on same server

I also want to achieve replication from db test to myslave2 on same server along with myslave

Basically it will be one master db and two slave db replicating the s开发者_如何学运维ame master db

Regards, Rizwan


Here is my code from my.cnf:

[mysqld]
server-id=1
report-host=master-is-slave-host
log-bin=/var/log/mysql/mysql-bin.log
log-bin-index=/var/log/mysql/mysql-bin.index
relay-log=/var/log/mysql/mysql-relay-bin.log
relay-log-index=/var/log/mysql/mysql-relay-bin.index
expire_logs_days=10
replicate-same-server-id=1
binlog-do-db=masterdb
log-error=/var/log/mysql/error.log
replicate-rewrite-db=masterdb->slavedb
replicate-do-table=slavedb.some_table
0

精彩评论

暂无评论...
验证码 换一张
取 消