There may be situations where you have a single master and want to replicate different databases to different slaves. For example, you may want to distribute different sales data to different departments to help spread the load during data analysis. A sample of this layout is shown in Figure 15.2, “Using replication to replicate separate DBs to multiple hosts”.
You can achieve this separation by configuring the master and
slaves as normal, and then limiting the binary log statements that
each slave processes by using the
replicate-wild-do-table configuration option on
each slave.
For example, to support the separation as shown in
Figure 15.2, “Using replication to replicate separate DBs to multiple hosts”, you would configure
each slave as follows before enabling replication using
START SLAVE:
MySQL Slave 1 should have the following configuration options:
replicate-wild-do-table=sales.% replicate-wild-do-table=finance.%
MySQL Slave 2 should have the following configuration option:
replicate-wild-do-table=support.%
MySQL Slave 3 should have the following configuration option:
replicate-wild-do-table=service.%
If you have data that needs to be synchronized to the slaves before replication starts, you have a number of options:
Synchronize all the data to each slave, and delete the databases and/or tables that you do not want to keep.
Use mysqldump to create a separate dump
file for each database and load the appropriate dump file on
each slave.
Use a raw data file dump and include only the specific files
and databases that you need for each slave. This option will
not work with InnoDB databases unless you use the
innodb_file_per_table option.
Each slave in this configuration will transfer to the entire binary log from the master, but will only execute the events within the binary log that apply to the configured databases and tables.

User Comments
Add your own comment.