Percona XtraDB Cluster: Setting up a simple cluster

Percona XtraDB Cluster: Setting up a simple cluster


Percona XtraDB Cluster (PXC) is different enough from async replication that it can be a bit of a puzzle how to do things the Galera way.  This post will attempt to illustrate the basics of setting up 2 node PXC cluster from scratch.


Two servers (could be VMs) that can talk to each other.  I’m using CentOS for this post.  Here’s a dirt-simple Vagrant setup: to make this easy (on Virtualbox).

These servers are talking over the internal network for our example.

Install the software

These steps should be repeated on both nodes:

Disable IPtables and SElinux

It is possible to run PXC with these enabled, but for simplicity here we just disable them (on both nodes!):

Configure the cluster nodes

Create a my.cnf file on each node and put this into it:

Note that the wsrep_node_address should be the proper address on each node.  We only  need this because in this environment we are not using the default NIC.

Bootstrap node1

Bootstrapping is simply starting up the first node in the cluster.  Any data on this node is taken as the source of truth for the other nodes.

We can see the cluster is Primary, the size is 1, and our local state is Synced.  This is a one node cluster!

Prep for SST

SST is how new nodes (post-bootstrap) get a copy of data when joining the cluster.  It is in essence (and reality) a full backup.  We specified Xtrabackup as our backup and a username/password (sst:secret).  We need to setup a GRANT on node1 so we can run Xtrabackup against it to SST node2:

This GRANT should not be necessary to re-issue more than once if you are adding more nodes to the cluster.

Start node2

Assuming you’ve installed the software and my.cnf on node2, then it should be ready to start up:

If we check the status of the cluster again:

We can see that there are now 2 nodes in the cluster!

The network connection is established over the default Galera port of 4567:


In these steps we:

  • Installed PXC server package and dependencies
  • Did the bare-minimum configuration to get it started
  • Bootstrapped the first node
  • Prepared for SST
  • Started the second node (SST was copied by netcat over port 4444)
  • Confirmed both nodes were in the cluster

The setup can certainly be more involved in this, but this gives a simple illustration at what it takes to get things rolling.


Share this post

Comments (4)

  • nurettin Reply

    The bootstrap on node1 worked (I had to remove mysql-libs before installing percona rpm)

    in node2 I copied the bare minimum my.cnf and changed:

    wsrep_node_address =

    then started:

    service mysql start

    ERROR! MySQL (Percona XtraDB Cluster) server startup failed!

    December 7, 2013 at 7:52 am
  • nurettin Reply

    131207 13:03:32 [Note] WSREP: gcomm: connecting to group ‘twonode’, peer ‘,’
    131207 13:03:32 [Warning] WSREP: (f97436fe-5f3f-11e3-95b1-bfa94871db44, ‘tcp://’) address ‘tcp://’ points to own listening address, blacklisting
    131207 13:03:35 [Warning] WSREP: no nodes coming from prim view, prim not possible
    131207 13:03:35 [Note] WSREP: view(view_id(NON_PRIM,f97436fe-5f3f-11e3-95b1-bfa94871db44,1) memb {
    } joined {
    } left {
    } partitioned {
    131207 13:03:35 [Warning] WSREP: last inactive check more than PT1.5S ago (PT3.51248S), skipping check
    131207 13:04:05 [Note] WSREP: view((empty))
    131207 13:04:05 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
    at gcomm/src/pc.cpp:connect():141
    131207 13:04:05 [ERROR] WSREP: gcs/src/gcs_core.c:gcs_core_open():196: Failed to open backend connection: -110 (Connection timed out)
    131207 13:04:05 [ERROR] WSREP: gcs/src/gcs.c:gcs_open():1292: Failed to open channel ‘twonode’ at ‘gcomm://,’: -110 (Connection timed out)
    131207 13:04:05 [ERROR] WSREP: gcs connect failed: Connection timed out
    131207 13:04:05 [ERROR] WSREP: wsrep::connect() failed: 7
    131207 13:04:05 [ERROR] Aborting

    December 7, 2013 at 8:09 am
  • Jay Janssen Reply

    Connection failed:

    131207 13:04:05 [ERROR] WSREP: gcs/src/gcs.c:gcs_open():1292: Failed to open channel ‘twonode’ at ‘gcomm://,′: -110 (Connection timed out)

    That’s the problem — make sure the 2nd node can reach the first on port 4567.

    December 9, 2013 at 7:29 am
  • Linda Reply

    Buenas. Una pregunta para instalar Percona Xtradb debo tener instalado mysql antes???
    Y debo crear un fichero /etc/mysql/my.cnf para la configuracion??

    February 7, 2016 at 10:54 am

Leave a Reply