20
votes

We are using Amazon RDS and we have a MASTER replicating to a SLAVE.

We want to create a new slave that will only replicate specific databases or tables from the master.

By default RDS simply just replicates the entire master's databases over to the slave's. But we only want to do specific tables. I know this is possible in MySQL in general, but I'm not sure about RDS and I can't find an answer anywhere.

These settings exists in MySQL, I do not see them on the custom parameter settings for RDS unless I'm missing something.

--replicate-ignore-db=db_name
--replicate-ignore-table=db_name.tbl_name
4

4 Answers

14
votes

This isn't possible with RDS.

You can "fake it" by converting the tables you don't want replicated to Engine=Blackhole, however you have to edit your parameter-group and set "read-only" to 0, instead of the default "{TrueIfReplica}".

Alternately, you would need to run your own slave server on EC2 with the RDS server as the master (this is possible if you're running MySQL 5.6 on RDS, but not 5.5 or below), however it's extremely complicated to set up.

1
votes

AWS RDS has changed it is supported now. rds parameters for db replication vs instance replication:

1
votes

Amazon RDS for MySQL and MariaDB support replication filtering

Posted On: Feb 12, 2021

Amazon Relational Database Service (Amazon RDS) now supports replication filters for MySQL and MariaDB instances. Replication filters specify which databases and tables are replicated in a read replica. Customers create lists of databases and tables to include or exclude for each replica.

To learn more about replication filtering and how to apply it to your instances, please see the Amazon RDS user guide for MySQL or MariaDB.

To configure replication filters, set the following replication filtering parameters on the read replica:

  • replicate-do-db
  • replicate-ignore-db
  • replicate-do-table
  • replicate-ignore-table
  • replicate-wild-do-table
  • replicate-wild-ignore-table

The parameters are evaluated in the order that they are listed. For more information about how these parameters work, see the MySQL documentation.

0
votes

As Kat said, no, they don't provide that feature.

I don't expect it either, since we could use it to break their as-a-service encapsulation, which requires certain tables to replicate for primary features to work.

A work-around that I'm considering, is to create an EC2 based MySQL instance in between the master and the slave in the replication chain (using the external replication feature), with those filters applied, and the black-hole engine pre-set for all tables, just to keep things easy.

One bonus advantage, is that the RDS slave has less binary log data to parse, since it's pre-filtered.