apprentice – how I stopped worrying about slave lag and love replication – apprentice



apprentice – how I stopped worrying about slave lag and love replication – apprentice

0 0


devpar-apprentice

Barcamp talk given at Developer's Paradise 2013

On Github moritzheiber / devpar-apprentice

apprentice

or

how I stopped worrying about slave lag and love replication

apprentice

A MariaDB/MySQL slave lag and cluster integrity checker

Apprentice is tiny server application (under 300 lines of ruby code) that determines the integrity of a running MariaDB/MySQL slave or MariaDB Galera master-master cluster member and responds to HTTP requests on a pre-defined port, depending on the state of the server it is checking on.

slave lag

Slaves always lack a little behind => Transaction in Checkout, read-write issues Read-write splitting should be done, transactions/checkout only on master

  • Seconds_Behind_Master < 120 seconds (or --threshold)
  • Slave_IO_Running == Yes

clustering

MariaDB Galera cluster

MariaDB Galera cluster => Codership Integrated into the regular MariaDB distribution

  • wsrep_cluster_size > 1
  • wsrep_ready == Yes
  • wsrep_local_state == 4 (or 2, depending on --accept-donor)

made with and ruby

ruby (2.x), rubygems

eventmachine

mysql2::EM

installation

$ gem install apprentice

gem2deb also works, some packages might be provided in the future

usage

$ apprentice --server localhost --user root --password password --type mysql

https://github.com/moritzheiber/apprentice

© knowyourmeme.com

better docs™

rspec tests

global configuration

logging handler

this presentation (including notes etc.): https://moritzheiber.github.io/devpar-apprentice

thank you for listening!

 @moritzheiber

 github.com/moritzheiber

 moritz.heiber@gmail.com