Skip to content

Instantly share code, notes, and snippets.

John Dalton johndalton

Block or report user

Report or block johndalton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
johndalton /
Last active Nov 12, 2017
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

   / \
  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,

View fun_with_bitstrings.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:f8bc9055fa03b19d1870
oysttyer(13252,0x7fff7e679000) malloc: *** error for object 0x7fef3cb0f228: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
View .oysttyerrc
# Imported old TTYtter config for oysttyer.
# Now using OAuth, with key in .ttytterkey
# Not needed with the streaming API.
# mentions=1
ksp="$HOME/Library/Application Support/Steam/SteamApps/common/Kerbal Space Program/"
transfer() {
# Take an optional destination argument in case the destination file has a different name.
if [ "Z$2" != "Z" ]
View .vimrc
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 ( 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:

View database.yml.erb
# This file should be in .../cookbooks/database/templates/default/database.yml.erb
<%= @environment %>:
adapter: <%= @adapter %>
database: <%= @database %>
username: <%= @username %>
password: <%= @password %>
host: <%= @host %>
<canvas id="myCanvas" width="800" height="600">
Fallback content, in case the browser does not support Canvas.
var myCanvas, context;
You can’t perform that action at this time.