Riz
Riz

Reputation: 368

MySql - Two slave database replication

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 same master db

Regards, Rizwan

Upvotes: 2

Views: 659

Answers (1)

maya89
maya89

Reputation: 25

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

Upvotes: 1

Related Questions