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

MySql Switching Masters During Failover with log-slave-updates

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

Problem

I am still pretty newbie to mysql. This question is regarding promoting slave with option --log-slave-updates to become a master.

The typical schema of promoting slave to master was described in 15.3.6 Switching Masters During Failover. Here you can find very strict steps how to do it :


Run your slaves with the --log-bin option and without --log-slave-updates. The reason for running the slave without --log-slave-updates is to prevent slaves from receiving updates twice in case you cause one of the slaves to become the new master.

Let's say I have the schema like the following (the image was taken from 15.3.5. Improving Replication Performance).

Where Master 2 is actually a slave with --log-slave-updates and bin-log enabled. I need to enable --log-slave-update in order to save bin-log from the Master 1 to bin-log of Master 2 and then transfer it to all slave. In case of failover I need promote Master 2 to the role of Master 1. But there is a contradiction to the standard MySql failover schema I have --log-slave-updates enabled which can cause a problem.

In your opinion. What the action I should take in order to do this?

Solution

The warning about --log-slave-updates will only apply if you had multiple intermediary 'Master/Slave' servers.

The warning is this (my emphasis):


Then it will write updates that it receives from Master to its own binary log. When Slave 2 changes from Master to Slave 1 as its master, it may receive updates from Slave 1 that it has already received from Master

But in your scenario, Slave 2 is not changing masters, it will still point to the same Master 2 server it always was at.

So now, in case of Master 1 failing, you will need to do two things:

  • Make sure your applications point to Master 2



  • Follow the instructions on promoting one of the three slaves to be new Master 2



  • make sure to enable --log-slave-updates on the new Master 2

Context

StackExchange Database Administrators Q#12224, answer score: 3

Revisions (0)

No revisions yet.