What is the difference between 'replicate-rewrite-db' and 'replicate-do-db ' during mysql replication ?

StackOverflow https://stackoverflow.com/questions/11024312

  •  14-06-2021
  •  | 
  •  

Frage

I am trying to set up mysql replication. I saw both the mentioned options used in different places. I think replicate-rewrite-db is used when the names of the database in the master and the slave are different. Is that the only difference between these two options. Also is there similar option for rewriting/renaming master to slave tables during replication?

War es hilfreich?

Lösung

They're not really related.

replicate-rewrite-db is used to change the database specified when a query includes a "USE" statement (that is, if a query to the master was "USE foo", it might be translated to "USE bar" in the query executed on the replicant).

replicate-do-table tells MySQL to restrict the replication stream to the specified table(s), so that only queries made against that (or those) table(s) are replicated on the slave.

This article has in-depth details on replication options you can set: http://dev.mysql.com/doc/refman/5.0/en/replication-options-slave.html

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top