MySQL Replication – Multi-Master and Multi-Slave Setup

MySQLreplication

I have been having some issues creating a redundant multi master setup. Here's the proposed layout:

dbsetup

The problem I'm having is when something is written to master1 it replicates to slave1 and master2 but not slave2. And when something is written to master2 it replicates to slave2 and master1 but not to slave 1.

Is there any way I can get this to work where both slaves are updated no matter which master is written to?

Best Answer

Problem

When a Master is also a Slave, you need to have log-slave-updates.

From what you described, each Master does not have log-slave-updates configured.

Solution

STEP 01) STOP SLAVE; on Slave1

STEP 02) STOP SLAVE; on Slave2

STEP 03) STOP SLAVE; on Master1

STEP 04) STOP SLAVE; on Master2

STEP 05) On Master1, add this to /etc/my.cnf

[mysqld]
log-slave-updates

STEP 06) On Master2, add this to /etc/my.cnf

[mysqld]
log-slave-updates

STEP 07) On Master1, Run service mysql restart --skip-slave-start

STEP 08) On Master2, Run service mysql restart --skip-slave-start

STEP 09) START SLAVE; on Slave1

STEP 10) START SLAVE; on Slave2

STEP 11) START SLAVE; on Master1

STEP 12) START SLAVE; on Master2

That's it. Everything should replicate properly from here.

Give it a Try !!!

I have discussed this before