Galera Arbitrator & Cluster
A Galera cluster has a minimum require to have 3 nodes to function correctly and have an healthy quorum(or an odd number of nodes if you want to go over 3 nodes). In the event that you want to run Galera cluster on 2 nodes, you can substitute the 3rd database node by an arbitrator which will act as your 3rd member of your quorum. The same logic can be apply if you want to run 4 database nodes but keep an healthy quorum. The Galera Arbitrator (garbd, for short) will ensure that the cluster does not lose its quorum. It needs to be installed on a server outside the Galera cluster and will generate minimum load there so a smaller machine can be used.
We begin by installing the Galera packages and repository:
apt-get install software-properties-common
apt-key adv --keyserver keyserver.ubuntu.com --recv BC19DDBA
Create a repository file and add it in the source list, /etc/apt/sources.list.d/galera.list.
deb http://releases.galeracluster.com/ubuntu trusty main
apt-get install galera-3 galera-arbitrator-3
Once this is installed, you only need one command to have the galera arbitrator connect to the cluster. Replace the IPs and cluster name with your current cluster values:
garbd –a gcomm://192.168.0.1,192.168.0.2 –g cluster_name
We will now edit the default Ubuntu Galera arbitrator file so that garbd will start up with the proper parameters.
# Copyright (C) 2012 Codership Oy
# This config file is to be sourced by garb service script.
# A comma-separated list of node addresses (address[:port]) in the cluster
# GALERA_NODES="192.168.0.1 192.168.0.2"
# Galera cluster name, should be the same as on the rest of the nodes.
# Optional Galera internal options string (e.g. SSL settings)
# see http://galeracluster.com/documentation-webpages/galeraparameters.html
# Log file for garbd. Optional, by default logs to syslog
You can then start the garbd service.
service garbd start
You have a Galera Cluster running 2 database node and a separate arbitrator to keep the quorum healthy. Let us know how your Galera Cluster handle your workload. If this guide was helpful to you, kindly share it with others who may also be interested.