MySql - 两个从属数据库复制

时间:2011-10-10 07:10:51

标签: mysql replication database-replication

我想实现相同的服务器复制,这样一种方式会有两个数据库在同一台服务器上复制一个数据库

这是我在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**

以上代码适用于从同一服务器上的db test到myslave的复制

我还希望在同一服务器上实现从db test到myslave2的复制以及myslave

基本上它将是一个主db和两个slave db复制相同的主db

此致 RIZWAN

1 个答案:

答案 0 :(得分:1)

以下是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