Skip to content

Instantly share code, notes, and snippets.

@joshuasign
joshuasign / MySQL_HOTREBUILD_SLAVE_from_MASTER.sh
Last active November 9, 2018 11:07 — forked from sgtsquiggs/MySQL_REBUILD_LIVE_SLAVE_from_MASTER.sh
MySQL_REBUILD_LIVE_SLAVE_from_MASTER
#!/usr/bin/env bash
# Name: MySQL_HOTREBUILD_SLAVE_from_MASTER.sh by Joshua_sign
# original version was MySQL_REBUILD_LIVE_SLAVE_from_MASTER by Matthew Crenshaw
#
# Purpose: Rebuilds live for one or all Databases of a SLAVE replication server based on a good running MASTER server
# This rebuilt action is done without stopping the MASTER MySQL server BUT by locking the MASTER server tables
# during the backup of master databases with the F method (minimal duration possible)
# or during the whole transfert with the P method.
# Note that a main difference with the original script of Matthew Crenshaw, this version is used for a symetric MASTER/SLAVE.
# In other words, the SLAVE can became a MASTER if the MASTER go down, and MASTER can became SLAVE if needed.