A Practical Guide to Adding and Updating MySQL Replication Filters

November 27, 2026
Author
Bhuvanes Waran
Share this Post:

Managing MySQL replication filters in a live production environment doesn’t have to mean rebuilding your replicas from scratch. In this post, we’ll walk through how to safely exclude specific tables from replication and cleanly re-sync and add live tables back into the replication stream using mydumper and binlog coordinates, without ever touching the primary server.

Why use replication filters?

In MySQL, the primary-replica (formerly master-slave) architecture is the most widely used deployment pattern. Replication filters let you build replicas that hold only the data a team needs. Some teams need transaction data, others need analytics data, and a multi-source replica may combine data from several sources. Replicating less also reduces resource use.

Needs change over time, so you will often have to update a replica’s filters, either to stop replicating some tables or schemas, or to start replicating them again.

Ignoring a table on the replica is a quick filter change

Stopping replication for the tables/schemas is easy. Just stop the replication, add/update the tables/schemas in the replication filters, and start the replication. See the example below to stop replication for the table sbtest.sbtest3. 

Example:

Replication status before adding the filters:

Adding the table sbtest.sbtest3 to the replication filters:

Check that the table gets no more writes

Hashing the same value three times means the table is no longer receiving writes from the primary.

Why restoring a dump isn’t enough for a live table?

When the requirement is to add or update a table or database in the filters to replicate data from the primary to the replica, we need to work carefully; a small mistake can cause a replication error on the replica, and we may end up rebuilding it from scratch.

For this, we usually think that just taking a dump backup from the primary or another replica and restoring it on the replica may work. But this will not be enough for the live tables/databases. We also need to stop the replication and start replication with the correct file/position. The high-level plan for this task is below.

  1. Stop replication on the target replica where filters need to be added or updated.
  2. Take a consistent mydumper backup from the primary or another suitable replica. Make sure to capture the primary’s binlog file and position corresponding to the backup snapshot.
  3. Start replication on the  target replica until the binlog file  and position we got from mydumper
  4. Restore the dump on the target replica
  5. Add/update the replication filter on the target replica.
  6. Start the replication

Here is an example of how I added the table sbtest.sbtest3  back into the replication. 

Step 1: Stop replication cleanly on the target replica

The target replica uses multi-threaded replication. START REPLICA UNTIL SQL_AFTER_MTS_GAPS lets the parallel applier threads fill any gaps, ensuring the replica’s position is consistent, after which the SQL thread stops automatically. With a single applier thread, you can skip this and run STOP REPLICA.

Step 2: Take a mydumper backup from another replica

Take a dump from another replica using mydumper with the –replica-data option to capture the primary’s binlog file and position. This allows you to avoid touching the primary.

The metadata file records where the primary’s binary log was when the dump was taken. We need that position for the next step, to stop the target replica at the same point.

Step 3: Start replication until the dump’s position

Get the primary binlog and position from the metadata file, start replication until the primary binlog and position match, and wait a while for it to sync with the file and position.

After some time, the SQL thread stopped once it reached the file and position

Step 4: Restore the dump on the target replica

Restore the dump to the target replica where we need to update the filters. The replication SQL thread is paused at the dump’s position, so the restore won’t conflict with any changes the replica is applying.

Step 5: Remove the table from the filter

Remove the replication filter so it defaults to replicating all the data from the primary.

In this example, there is a single table to remove, so I used empty braces. If multiple tables are added to the replication filter, you may need to remove the specific table while keeping the others.

Example:

Step 6: Start replication

Verify that the table is receiving writes from the primary and that there are no replication errors. You can also use pt-table-checksum to verify the data consistency.

Please note the replication status output above is trimmed to make the blog post short.

Conclusion

This structured approach ensures data consistency while minimising maintenance overhead. I hope the above example gives ideas for how to play with replication filters and helps update MySQL replication in live production without ever touching the primary. Using the above approach, you can add/update multiple tables or schemas in the replication filters.  Please comment if you have any questions/comments.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved