Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

filter mysql replication (ignore-db)

mysql ignore-db works according to server my.cnf AFAIK,

i.e.

binlog-ignore-db                        = mysql
replicate-ignore-db                     = mysql

I am not sure, if this works from client side too, can anyone explain the mechanism, how can i be able to send from master but not accept in client side.

Why i want to do this? I have multiple slave "2 slave" must replicate MySQL table where as in other 2 should not be overwriten. Where as every other table will be replicated.

Reading this: http://dev.mysql.com/doc/refman/5.6/en/replication-rules-db-options.html didnt make me clear enough.

like image 973
tike Avatar asked Sep 16 '13 14:09

tike


People also ask

What is the meaning of binlog_ do_ db filter in replication?

The binlog_do_db option allows you to configure a replication master to write statements and transactions affecting databases that match a specified name into its binary log. Since the filtered statements or transactions will not be present in the binary log, its replicas will not be able to replicate them.

What is replication filtering?

A replication filter is used to filter out the necessary databases and tables that will be replicated in the replica. The replication filter can be set either in my. cnf or the command line. The change made in those databases will be logged in binary log files.

Does MySQL support replication?

Replication in MySQL supports different types of synchronization. The original type of synchronization is one-way, asynchronous replication, in which one server acts as the source, while one or more other servers act as replicas.


1 Answers

binlog-ignore-db is a master-side setting, it tells the Master not to log changes taking place on the listed DB.

replicate-ignore-db is a slave-side setting, it tells the Slave to ignore incoming log information related to the listed DB

The typical use case is when you want to replicate different databases from one single Master to different Slaves. The Master must log all changes occurring in all databases (minus those possibly excluded by binlog-ignore-db, i.e. database that will not be replicated anywhere).

Each Slave will receive the full binary log, but will only replicate changes related to the selected databases (i.e. databases not excluded by replicate-ignore-db -- this list would be different on each Slave).

(mysql database being a system database, it should be ignored from both ends, unless you really, really really know what you are doing).

like image 158
RandomSeed Avatar answered Oct 24 '22 08:10

RandomSeed