July 26, 2014

Install Percona XtraDB Cluster on CentOS 6.2

Percona XtraDB Cluster is a new high availability and high scalability solution for MySQL users. XtraDB Cluster integrates Percona Server with the Galera library of high availability solutions in a single product package. Percona XtraDB is an enhanced version of the InnoDB storage engine for MySQL and MariaDB. It has much faster performance than InnoDB and better scalability on modern hardware.

This tutorial is how to setup a 3-node XtraDB cluster, assuming you are running CentOS Linux 6.2 64-bit.

Install Percona’s CentOS 6 repositories:

# rpm -Uhv http://repo.percona.com/testing/centos/6/os/noarch/percona-testing-0.0-1.noarch.rpm
# rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

Install Percona XtraDB Cluster packages:

# yum install Percona-XtraDB-Cluster-server Percona-XtraDB-Cluster-client

XtraDB Cluster requires a couple of TCP ports to operate. Easiest way:

# service iptables stop

If you want to open only specific ports, you need to open 3306, 4444, 4567, 4568 ports.

For example for 4567 port (substitute by your IP):

# iptables -A INPUT -i eth0 -p tcp -m tcp –source –dport 4567 -j ACCEPT

Now repeat on all XtraDB cluster nodes

Create /etc/my.cnf files

On the first XtraDB Cluster node (assume IP

On the second XtraDB Cluster node:

On the third XtraDB Cluster node:

Start mysqld on the first node:

# service mysql start

When all nodes are in SYNCED stage your cluster is ready!

Connect to database on any node and create database:

# mysql
> CREATE DATABASE how2centos_test;

The new database will be propagated to all nodes.