Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

MySQL replication: Master to Multiple Slaves with table filtering

$
0
0

I have 2 separate web systems (A, B) that will end up using the same 5 tables. I'm using MySQL. System A has only one database (A1). System B has at least 3 databases (B1, B2, B3) on different machines.

Only the System A will be responsible for creating, editing and deleting the records on 5 specific tables that need to be shared, so it will be the Master server (considering only these tables). All 3 bases of system B will read this data, not change it.

So I thought: well, I'll just set up MySQL Replication, one master to multiple slaves shouldn't be a problem.

As I worked through it, I noticed that I can't just replicate the 5 tables that I need, according to this: http://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html#option_mysqld_replicate-rewrite-db

In order for table filtering to work, my databases need to share the same name. But they don't. So I need to use the replicate-rewrite-db option, and with this option, the filtering doesn't work. Changing the name of the databases now wouldn't be the best option.

What's the best alternative for this scenario? I remembered testing the FEDERATED storage engine once, but it feels unsafe and slow, since it doesn't support foreign keys and indexes. Would it be too ugly to create 3 separate databases on system B with the same name as the system A, just so the replicate with table filtering work? And then I would create triggers on these tables to insert/update/delete on the correct database. Seems like a hell lot of work for a simple thing, though.


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>