HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

One slave, multiple masters MySql

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
slaveonemysqlmultiplemasters

Problem

Is it possible to set-up MySql Replication to have one slave listening to two different masters?

Solution

Rolando's solution has many caveats. The first being one replica stream is necessarily not replicating while the other works. This is going to give you periods of time where your slave is out of synch. You now have to play a delicate balancing act to ensure each has enough time to catch up when it has its "turn".

As described you also have to play book keeper of log positions to switch back to. This really just seems buggy, opening the window for missing or inconsistent data or even breaking replication when it goes wrong (either being caused by even a just 'off by one' error in the log position)

I would recommend just running multiple mysql instances. There's nothing stopping you from running two or more mysql's on the same machine. They cannot both operate on the same port of course. I don't really see this as being a problem though as every client and library allows you to specify something other than 3306.

Just specify port=3307 (or whatever in one of the .cnf files).

You will also want to take care in ensuring the individually configured buffer pools and other memory configurations aren't at odds with each other. This is actually a benefit though as you can more finely tune those settings to the specific requirements of the individual databases that are being replicated.

This way you just have two replication streams running into the same server; never behind, no book keeping required, no "swapping" script required.

Context

StackExchange Database Administrators Q#12178, answer score: 4

Revisions (0)

No revisions yet.