I have some master-slave replication with some schemas not being replicated, via replicate-ignore-db in the my.cnf. Doing some research about how that parameter works, found this:
Statement-based replication. Tells the slave SQL thread not to replicate any statement where the default database (that is, the one selected by USE) is db_name.
Row-based replication. Tells the slave SQL thread not to update any tables in the database db_name. The default database has no effect.
We're currently working with SBR and can't change it to RBR, because RBR reults in too much delay with some queries that UPDATE many rows.
Other thing to consider is that we have like 50 persons who access and modify the database using programs like SQLYog, DBeaver, etc... and work with various schemas in one day; so there's the risk that at one time they USE one schema and later in the day they modify other schema without changing the current database, so it wouldn't replicate.
Here's an example, hoping it helps me explain:
Let's imagine I have two schemas:
schema1 <- Don't replicate
schema2 <- Replicate
And one of the persons do the following
mysql> USE schema1;
mysql> CREATE TABLE dummy(id INT(1));
mysql> .... more queries in that schema...
mysql> CREATE TABLE schema2.table(id INT(1));
Then ends the session, later on he starts a new session and does:
mysql> INSERT INTO schema2.table VALUES (1);
This will break the replication, since schema2.table doesn't exists in the slave because the CREATE was ignored. Is there a safer way to ignore databases? One idea was to "deny" the USE schema to their users, this would ensure that everything is replicated correctly (could cause to some instructions for the schema1 to be replicated, but it's better than not replicating something important...)