master-slave synchronization mysql database or table portion of the library

Original: https: //www.2cto.com/database/201708/674665.html

There are two ideas of data synchronization section, 1.master send only needed; 2.slave receive only desired.

master side:

binlog-do-db binary logging database (multi-database comma separated)

binlog-ignore-db ignore the binary log database (multi-database comma separated)

for example:

1) binlog-do-db = YYY database to be synchronized, not including the sync. (Do not add this line represents synchronize all)

Here only the main library synchronization test1, test2 library.

Write pictures described here

2) binlog-ignore-db = mysql This is not recorded binlog, to achieve from a library of sync mysql database to ensure that their rights

binlog-ignore-db=performance_schema

binlog-ignore-db=information_schema

Here to synchronize ignored test1, test2 library from the library

Write pictures described here

slave端

replicate-do-db is set to be copied database (multi-database using a comma separated)

replicate-ignore-db database replication is set to be ignored (multi-database using comma separated)

replicate-do-table setting table to be copied

replicate-ignore-table set replicated tables to be ignored

replicate-wild-do-table replication-do-table with the same function, but wildcards

replicate-wild-ignore-table like replication-ignore-table functions, but may add wildcards

The above comparison, replicate here on a good understanding, simply following points.

E.g:

Ignore test3 database copy from the library, but it should be noted that, in fact, from relaylog library from the relevant log on test3, but nothing from the library is not used.

Write pictures described here

Write pictures described here

Add two configuration wildcards

replicate-wild-do-table = db_name.% which library which table only replication

replicate-wild-ignore-table = mysql.% which table which library to ignore

【Finish】

Guess you like

Origin www.cnblogs.com/mynale/p/11018690.html