Skip to content

Instantly share code, notes, and snippets.

@johndalton
johndalton / replication_shuffle.md
Last active November 12, 2017 11:41
Doing the Replication Shuffle

Doing the Replication Shuffle

Here's the scenario. You have three hosts, a master (M) and two replicas (R and S).o

    M
   / \
  R   S

You want to move the replica S so that its master is R, like so:

#Remastering MySQL Replicas

The scenario here is that we have two replicas, A and B, which both share a master M. We want to make B a replica of A, so that the replication chain goes M > A > B. A prerequesite is that A needs to have binary logging enabled with log_slave_updates turned on, and A should not be receiving any local writes other than from replication.

In order to achieve the switch we need to have a single point in time at which we know both A's replicaton position relative to the master M, and A's own binary log position. Then we need to make B reach the exact same position relative to the master, at which point we can change master to point at the corresponding coordinates on A.

This procedure involves stopping and restarting replication on both replicas; very briefly on A, but a couple of times on B. It shouldn't be performed on hosts that are especially sensitive to replication delay. However even when carrying out this process by hand the delay shouldn't exceed more than a few minutes,

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
oysttyer(13252,0x7fff7e679000) malloc: *** error for object 0x7fef3cb0f228: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
# Imported old TTYtter config for oysttyer.
# Now using OAuth, with key in .ttytterkey
ansi=1
ssl=1
vcheck=1
# Not needed with the streaming API.
# mentions=1
verify=1
dostream=1
#!/bin/bash
ksp="$HOME/Library/Application Support/Steam/SteamApps/common/Kerbal Space Program/KSP.app/Contents"
unity="/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/macosx64_nondevelopment_mono/UnityPlayer.app/Contents"
transfer() {
# Take an optional destination argument in case the destination file has a different name.
if [ "Z$2" != "Z" ]
then
dest=$2
set guifont=Liberation\ Mono:h17.00
set mouse=a
set modeline
set ruler
set showmode
set autoindent
set termencoding=utf-8
set window=37
colorscheme darkblue

Keybase proof

I hereby claim:

  • I am johndalton on github.
  • I am johndalton (https://keybase.io/johndalton) on keybase.
  • I have a public key whose fingerprint is 9E62 FCC1 C98B 912A 04BE 007D 4650 CB10 09AC D17D

To claim this, I am signing this object:

#
# This file should be in .../cookbooks/database/templates/default/database.yml.erb
#
<%= @environment %>:
adapter: <%= @adapter %>
database: <%= @database %>
username: <%= @username %>
password: <%= @password %>
host: <%= @host %>
<html>
<head>
<title>OMGCIRCLES!!1!</title>
</head>
<body>
<canvas id="myCanvas" width="800" height="600">
Fallback content, in case the browser does not support Canvas.
</canvas>
<script>
var myCanvas, context;