views:

171

answers:

1

I have set the Master DB Name as MDB & in the Slave server I set to replicate-do-db=SDB <-- this did not work? But when I set it up as the same DB name it works. Is there any solution out there to setup 1 master db with 2 different slaves but in the same server??

A: 

You need to specify the replicate-rewrite-db option:

--replicate-rewrite-db=from_name->to_name

"Tells the slave to translate the default database (that is, the one selected by USE) to to_name if it was from_name on the master. Only statements involving tables are affected (not statements such as CREATE DATABASE, DROP DATABASE, and ALTER DATABASE), and only if from_name is the default database on the master. This does not work for cross-database updates. To specify multiple rewrites, use this option multiple times. The server uses the first one with a from_name value that matches. The database name translation is done before the --replicate-* rules are tested."

If you are only replicating certain databases, you will need to specify the replicate-do-db. Note that the argument to this is the name of the database after the rename operation applied by replicate-rewrite-db:

--replicate-do-db=db_name
James McNellis
where do I put the replicate-rewrite-db code in the master side or slave side??
hkshambesh
On the slave side.
James McNellis