MySQL Table level Replication

MySQLmysql-5.5replication

I have 3 servers, say A,B &C. All have the equivalent data(same data). Now what I want is to make A as the master and B,C the slaves.

But the scenario is that I only want to replicate some of the tables from a single database of the master (server A).

All the servers are running with the same data. So no need to take the dump from the master and restore on the Slaves.

Just to set the replication for some tables from a single database.

Is there any harm in doing this? And what step(s) should I follow to achieve this?

Best Answer

As Phil mentions, the replicate-do-table option is what you will want to accomplish your goal. Just throwing out a couple of caveats:

  1. The overhead might be punishing on high write loads. Take a look at the logic to determine if a row in the binary log should be executed on the slave.

  2. Supposedly the binlog format of the master (row or statement) doesn't affect table filtering rules. However, from what I understand (not tested) if you have any stored routines that affect the table, the replicate-do-table rule does not apply:

    This option affects only statements that apply to tables. It does not affect statements that apply only to other database objects, such as stored routines. To filter statements operating on stored routines, use one or more of the --replicate-*-db options.

    So if you are using any stored procedures to modify tables, you might run into some issues with the replication failing.