Mysql – Remove particular table from being replicated in a Multi-Master replication

multi-masterMySQLmysql-5.6

I have followed all the steps in this link to set-up MySQL Master-Master replication for two database servers.

The master-master replication works fine.

Here is my my.cnf file, which contains some additional configuration than that present in the above link for auto-increment:

server-id = 1
replicate-same-server-id = 0
auto-increment-increment = 10
auto-increment-offset = 1

log_bin = "/var/lib/mysql/mysql-bin.log"
binlog_do_db = my_employee_database

log-slave-updates

expire_logs_days = 20

binlog_format = mixed

Similarly this is set-up in the other node with some changes.

my_employee_database has 4 tables:

  1. my_employee
  2. my_company
  3. my_address
  4. my_audit.

Question

Is there a way I can ignore or stop or remove the table my_audit from being replicated among the two server nodes and have the replication run normally for the other 3 tables as it is?

Environment

Database: MySQL 5.6.25
OS: CentOS 6.5 64 bit

Best Answer

Yes you can, simply add replicate-ignore-table in your my.cnf . please refer following link for mysql documentation :

https://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html#option_mysqld_replicate-ignore-table