This section provides additional explanation and examples of usage for different combinations of replication filtering options.
Some typical combinations of replication filter rule types are given in the following table:
Condition (Types of Options) | Outcome |
---|---|
No --replicate-* options at all: |
The slave executes all events that it receives from the master. |
--replicate-*-db options, but no table options: |
The slave accepts or ignores statements using the database options. It executes all statements permitted by those options because there are no table restrictions. |
--replicate-*-table options, but no database options: |
All statements are accepted at the database-checking stage because there are no database conditions. The slave executes or ignores statements based solely on the table options. |
A combination of database and table options: | The slave accepts or ignores statements using the database options. Then it evaluates all statements permitted by those options according to the table options. This can sometimes lead to results that seem counterintuitive; see the text for an example. |
A more complex example follows.
Suppose that we have two tables mytbl1
in
database db1
and mytbl2
in
database db2
on the master, and the slave is
running with the following options (and no other replication
filtering options):
replicate-ignore-db = db1 replicate-do-table = db2.tbl2
Now we execute the following statements on the master:
USE db1; INSERT INTO db2.tbl2 VALUES (1);
The outcome may not match initial expectations, because the
USE
statement causes db1
to be the default database. Thus the
--replicate-ignore-db
option
matches, which causes the INSERT
statement to be ignored. Because there was a match with a
database-level option, the table options are not checked;
processing immediately moves to the next statement executed on
the master.
User Comments
Add your own comment.