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

How I monitor my Raspberry Pi trackers

How I monitor my Raspberry Pi trackers

Build a Server-less Application using AWS Lambda Functions with Netlify

Garnet Silver presentable wholesales Ring Red L-1in UK KMOQ

Ensure Your DevOps Work Stays Relevant

A Comparison of Different Methods of Changed Data Detection in SQL Server Integration Services

Grid Iron Css

Using Multiple Post Processing Profiles and Reflection Probes

An open source boilerplate for you next SaaS product, written in django

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

ELK Stack ElasticSearch, Kibana and Node.Js : Store Logs on ELK

Docker in a Nutshell

Getting Started with Docker — Part 01

Getting Started With Docker Compose