MySQL support same-server replication into another database, Its quite a weired requirement, but in reality weired is common.
Consider a server 192.168.5.70, which has 2 databases db1 and db2
Now we shall set up replication for two tables on db1, ie. table1 and table2.
Here is the my.cnf
[mysqld] server-id=1 #### Replication #### report-host=master-is-slave-host log-bin=192.168.5.70-binlog relay-log=192.168.5.70-relaylog replicate-same-server-id=1 binlog-do-db=db1 # Note.... On rewrite, the
Lets look at it carefully.
replicate-same-server-id=1
This is to tell the slave the commands that it has to execute will be having the same server-id as its own.
binlog-do-db=db1
To log only database db1
replicate-rewrite-db=db1->db2
Let the slave know that whatever command is for db1 it has to execute on db2
replicate-do-table=db2.table1
replicate-do-table=db2.table2
Note how the table in db2 is replicated, as against the general thinking of db1.table1, MySQL could be using some buffered string and then evaluating the replicate-do-table rule.
Del.icio.us
Digg
Reddit
Facebook
StumbleUpon