Setting up a Percona Mysql Multi-Master cluster with HA using RedHat PCS.

  1. Install Percona XtraDB Cluster on all 3 nodes (I recommend, _always_ use an odd number of nodes to avoid split-brain problems)
  1. Install pcs
# yum install pcs
# systemctl start pcsd
# systemctl enable pcsd
# passwd hacluster (set your password)
# pcs cluster auth test01 test02 test03
  • Be sure that all the nodes see each other, either via DNS or via the /etc/hosts file.
# pcs cluster setup — name VIP test01 test02 test03
  • Now let’s enable the cluster and start it:
# pcs cluster enable --all
# pcs cluster start --all
  • Let’s set these 2 directives
# pcs property set stonith-enabled=false
# pcs property set no-quorum-policy=ignore
  • Now that the cluster is active we have to set up a proper sysctl to allow Percona to bind itself on ip addresses that are not locally configured on the running server:
# sysctl -w net.ipv4.ip_nonlocal_bind=1
  • Add also the following directive in /etc/sysctl.conf
  • Once this is done, we create the resource called VIP, which will be an ip address that will run inside the cluster:
# pcs resource create VIP ocf:heartbeat:IPaddr2 ip=  cidr_netmask=32 op monitor interval=5s
  • VIP resource is now ready. With the help of the command:
# pcs cluster standby test01
# pcs cluster unstandby test01
# pcs resource create mysqld systemd:mysqld clone --force meta is-managed=false op monitor interval=5
  • Create a resource named mysqld by associating it with the local systemd mysqld service.
  • Clone it on all 3 servers.
  • Set is-managed = false, so PCS can’t stop / start it by itself. Being a DB I preferred to leave the stop and start operations carried out by me or by my colleagues.
  • Set the resource check interval to 5 seconds.
# pcs resource show
VIP (ocf::heartbeat:IPaddr2): Started test01
Clone Set: mysqld-clone [mysqld]
mysqld (systemd:mysqld): Started test01 (unmanaged)
mysqld (systemd:mysqld): Started test02 (unmanaged)
mysqld (systemd:mysqld): Started test03 (unmanaged)
pcs constraint colocation add VIP with mysqld-clone INFINITY




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Write a Pub/Sub Stream to BigQuery

If your Computer is the Cloud, what should its Operating System look like?

How to deploy your django web project to Heroku free

Date and Time


Esp32: External Sensor (with DHT11)

Python Data Structures

Setting Up Terraform Cloud with GCP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matteo Niccoli

Matteo Niccoli

More from Medium

Loop in Postman

Effective Session Management using Supertokens

Static Code Analysis

Docker in a Nutshell