You are here
Building Galera Replication from Scratch
Introduction
MySQL/Galera synchronous Multi-Master Replication consists of 2 parts:
- The wsrep patches for MySQL (codership-mysql) and
- the Galera Replication Plugin (galera).
If you do not want to download the prepared binaries you can build it on you own.
First you have to download the native MySQL sources, then patch it with the Galera wsrep patches and compile it. In a second step you have to build the Galera Plugin.
This is especially useful because in the standard Galera binary tar balls the garbd
(and possibly other tools) is not provided.
The following steps describe how to do it:
Prepare a patched MySQL
Download MySQL Sources
Download the normal MySQL source code:
wget http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz
Download wsrep Patch
Download the wsrep Patch for MySQL:
wget http://launchpad.net/codership-mysql/5.5/5.5.15-21.2/+download/mysql-5.5.15-wsrep_21.2.patch
Patch MySQL
Patch MySQL as follows:
cd /tmp tar xf /download/mysql-5.5.15.tar.gz cd mysql-5.5.15 patch -p1 < /download/mysql-5.5.15-wsrep_21.2.patch
If you want avoid this step you can also download the already patched codership-mysql directly as follows:
bzr branch lp:codership-mysql
or
bzr branch lp:codership-mysql/5.5
If you want to do create your own wsrep patch:
bzr branch lp:codership-mysql/5.5 cd 5.5 bzr diff -p1 -v --diff-options " --exclude=.bzrignore " -r tag:mysql-5.5.15..branch:lp:codership-mysql/5.5 \ > mysql-5.5.15-wsrep_21.2.patch
Compile MySQL with the wsrep patch
To compile the patched MySQL do the following:
chmod a+x BUILD/compile-amd64-wsrep BUILD/compile-amd64-wsrep --prefix=/home/mysql/product/mysql-5.5.15-wsrep-21.2 make install
Up to here this was the first step to get a prepared MySQL working with wsrep. Now we have to make the Galera Plugin...
Prepeare the Galera Replication Plugin
Download Galera Replication Plugin
The source of the Galera Replication Plugin you can get like this:
wget http://launchpad.net/galera/1.x/21.1.0/+download/galera-21.1.0-src.tar.gz
or if you want to get the most recent source take if directly from launchpad:
bzr branch lp:galera/1.x
Compile the Galera Replication Plugin
cd /tmp/ tar xf /download/galera-21.1.0-src.tar.gz cd galera-21.1.0-src/ scons cp garb/garbd /home/mysql/product/mysql-5.5.15-wsrep-21.2/bin/ cp libgalera_smm.so /home/mysql/product/mysql-5.5.15-wsrep-21.2/lib/plugin/
This is the whole magic. The most difficult thing is to put everything in the right order and to get the right packages in place (for Ubuntu/Debian: libboost-dev, libboost-program-options-dev
(>= v1.41), scons, libssl-dev, check, g++
(>= 4.4.0), etc.).
- Shinguz's blog
- Log in or register to post comments
Comments
Re: Building Galera Replication from Scratch
Why I build from source
garbd
,rsync
SST script).garbd
: This is the next but one topic (first I want to have a look aboutrsync
SST (and potentiallyssh
and LVM snapshot SST)... If you cannot wait for the blog I suggest you to subscribe to the Forum and ask questions there... Olire: Why I build from source
error with bzr branch lp:codership-mysq/5.5
Typo
Additions for compiling on RedHat/CENTOS