I have mysql8 DB in my Linux server. I want to setup Replica for this DB. In this DB I have multiple schemas, But I want to setup a replica for only one schema.
Is it possible to set up a replica for one schema?
If it is possible what is the process to setup.
Please anyone help regarding this issue.
Thanks in Advance.
CodePudding user response:
The version of mysql 8 can be referred to as follows:
change replication FILTER Replicate_Do_TabIe = (testdb) for channel 'testdbchannel';
Mysql 5.7 does not support FILTER.
CodePudding user response:
In MySQL 5.7 & MySQL 8,
We can apply below filters:
REPLICATE_DO_DB: Include updates based on database name. Equivalent to --replicate-do-db.
REPLICATE_IGNORE_DB: Exclude updates based on database name. Equivalent to --replicate-ignore-db.
REPLICATE_DO_TABLE: Include updates based on table name. Equivalent to --replicate-do-table.
REPLICATE_IGNORE_TABLE: Exclude updates based on table name. Equivalent to --replicate-ignore-table.
REPLICATE_WILD_DO_TABLE: Include updates based on wildcard pattern matching table name. Equivalent to --replicate-wild-do-table.
REPLICATE_WILD_IGNORE_TABLE: Exclude updates based on wildcard pattern matching table name. Equivalent to --replicate-wild-ignore-table.
REPLICATE_REWRITE_DB: Perform updates on replica after substituting new name on replica for specified database on source. Equivalent to --replicate-rewrite-db.
Example:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = (d1), REPLICATE_IGNORE_DB = (d2);
CHANGE REPLICATION FILTER REPLICATE_WILD_DO_TABLE = ('db1.old%');
CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE = ('db1.new%', 'db2.new%');
CHANGE REPLICATION FILTER REPLICATE_DO_TABLE = ('db1.old'); CHANGE REPLICATION FILTER REPLICATE_REWRITE_DB = ((db1, db2));