For practical purposes Galera/MySQL vendor recommend to reserve a “Reference Node” in the
cluster.
We propose the cluster looks like:
The red one (Node A) on the image is “Reference Node”. Others (Node B … Node N) are usual nodes.
Having such node in a cluster serves several purposes:
♦ Data consistency: since this node does not process any SQL load on its own, it has the lowest probability of transaction conflicts and therefore – in-deterministic conflict resolution. In the event of discovered database inconsistencies in the cluster this node will have the most relevant database.
♦ Data safety: since this node does not process any SQL load on its own, it has the lowest probability of failing with catastrophic consequences. In the event of total cluster failure (e.g. blackout) this will be the best node to restore cluster from.
♦ High availability: a reference node can serve as a dedicated state snapshot donor. Since it does not serve any clients, they won’t experience service interruptions and load balancer won’t need reconfiguration during SST.
The cluster should include two or more VPSes based on CentOS 5.4 x64 MySQL/Galera and phpMyAdmin or Debian 5.0 (Lenny) x64 MySQL/Galera and phpMyAdmin templates.
Here is step by step instructions on how to setup the cluster like this.
1. Get required number of Virtual Private Servers installed based on Galera/MySQL templates and destributives you prefer.
2. Configure Node A to be the “Reference node”.
Start new cluster with the command:
# mysql -e "set global wsrep_cluster_address='gcomm://';" |
3. Configure Node B to join existing cluster (interact with Node A)
Set wsrep_cluster_address value on the /etc/mysql/conf.d/wsrep.cnf file
wsrep_cluster_address="gcomm://<<em>Node A IP</em>>:4567" |
Restart MySQL service for CentOS
# service mysqld restart |
and for Debian
# /etc/init.d/mysql restart |
4. Configure Node C … Node N to join existing cluster (interact with Node A and B “via” Node B)
The nodes are configured same as Node B by pointing IP addresses of corresponded previous one. Like for Node C -> Node B, for Node D -> Node C, … , Node N -> …
Set wsrep_cluster_address value on the /etc/mysql/conf.d/wsrep.cnf file
wsrep_cluster_address="gcomm://<<em>Node B or C or ... IP</em>>:4567" |
Restart MySQL service (look at Step 3)
5. Re-configure Node A (the “Reference Node“) to join existing cluster
Set wsrep_cluster_address value on the /etc/mysql/conf.d/wsrep.cnf file
wsrep_cluster_address="gcomm://<<em>Node N IP</em>>:4567" |
Restart MySQL service (look at Step 3)