Mysql: Ignore Replication of Table in Multiple Databases

I have a MEMORY table that has the same name in multiple databases. Also, over time, new databases are created that contain this same table (so the list of databases containing the table varies over time).

Periodically a replication error that stops the slave occurs, caused by a duplicated key in that table (MySQL documentation points some problems that can occur when replicating MEMORY tables and I could be experiencing this problems). However, I don't need to replicate this table, so a posible solution could be to avoid replicating it.

Is there a way to avoid replicating all the tables that have the same name across multiple databases?

(something like --replicate-ignore-table=*.mytable or --replicate-wild-ignore-table=%.mytable)

Upvotes: 1

Views: 2297

Answers (1)

I've found the solution.

You can use --replicate-wild-ignore-table=%.mytable.

I tried it once before posting my question, but I made a mistake and instead of using --replicate-wild-ignore-table I used --replicate-wild-do-table... oops

Evenmore, MySQL documentation states that this is possible and shows the following example:

Example: --replicate-wild-ignore-table=foo%.bar% does not replicate updates that use a table where the database name starts with foo and the table name starts with bar.

Still, that documentation is long and someone (like me) could miss that part when looking to achieve the stated goal, so I'll leave this question and I'll post my answer in case that happens.

Upvotes: 1

Related Questions