# Percona xtraDB Cluster 8.x Setup With proxysql and keepalived as HA

**URL:** <https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154>\
**Category:** Percona XtraDB Cluster 8.x\
**Created:** [March 12, 2025, 10:25am UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154 "2025-03-12T10:25:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faisal\_Hassan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/faisal_hassan/32/20450_2.png) [@Faisal\_Hassan](https://forums.percona.com/u/Faisal_Hassan)\
**Post date:** [March 12, 2025, 10:25am UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/1 "2025-03-12T10:25:52Z")

</div>

Hi ,

We are setting up a Percona XtraDB Cluster with three nodes, each running on an AWS EC2 instance. To handle query routing, we plan to use ProxySQL, also deployed on an EC2 instance.

However, in this setup, ProxySQL becomes a single point of failure. To ensure high availability, we considered deploying Keepalived on two ProxySQL nodes. But since Keepalived relies on VRRP (multicast), which isn’t supported in AWS, we’re unsure if this is a viable solution.

Could you advise whether Keepalived can be used in this setup? If not, what would be the best approach to achieve high availability for ProxySQL in an AWS environment?

Looking forward to your recommendations.

---

<div class="post-metadata">

**Author:** ![Jostrus](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jostrus](https://forums.percona.com/u/Jostrus)\
**Post date:** [March 15, 2025, 8:20pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/2 "2025-03-15T20:20:34Z")

</div>

Hey @Faisal_Hassan,  
just for my understanding, the two ProxySQL nodes are in the same network (VPC)?  
If yes you can setup a pacemaker cluster with a virtual ip and the proxysql as a resource and add those two in a resource group. In that setup you configure your client to use the cluster ip of the pacemaker cluster for communication. In case one node goes offline the other node takes over the cluster ip and your cluster is still available.

---

<div class="post-metadata">

**Author:** ![Faisal\_Hassan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/faisal_hassan/32/20450_2.png) [@Faisal\_Hassan](https://forums.percona.com/u/Faisal_Hassan)\
**Post date:** [March 16, 2025, 5:20pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/3 "2025-03-16T17:20:48Z")

</div>

Hey @Jostrus,  
Firstly, thanks for your response! And yes, the two ProxySQL nodes are in the same VPC.  
I’ll try setting up Pacemaker as you suggested. Do you have any reference or guide for the setup?  
What about Keepalived? Will it work in this setup?

Looking forward to your insights!

---

<div class="post-metadata">

**Author:** ![Jostrus](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jostrus](https://forums.percona.com/u/Jostrus)\
**Post date:** [March 17, 2025, 2:54pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/4 "2025-03-17T14:54:41Z")

</div>

Hey @Faisal_Hassan,  
sure thing, here is an guide:

> **[Pacemaker-Corosync and HAProxy](https://cloudnfv.wordpress.com/2020/01/06/pacemaker-corosync-and-haproxy/)**
>
> We will see using Pacemaker and Corosync how we can mange a redundant HAProxy cluster using Virtual IP. In this example have only Two Nodes Node-1 and Node-2 so we would have to Disable quorum and …

> **[HAProxy High Availability Setup | Databases at CERN blog](https://db-blog.web.cern.ch/blog/antonio-nappi/2018-01-haproxy-high-availability-setup)**

I prefer HAProxy but that’s just my personal opinion. Keepalived will work as well with that setup. I also use keepalived and even ipvsadm for different use case scenarios but i just like haproxy a bit more.  
In case you want to use keepalived as an Loadbalancer instead of haproxy you have you use the systemd pacemaker resource: pcs resource create haproxy systemd:keepalived

> **[Chapter 11. Configuring cluster resources | Red Hat Product...](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/configuring_and_managing_high_availability_clusters/assembly_configuring-cluster-resources-configuring-and-managing-high-availability-clusters#proc_displaying-resource-specific-parameters-configuring-cluster-resources)**
>
> Chapter 11. Configuring cluster resources | Red Hat Documentation

I don’t know how much you know about pacemaker/corosync cluster so if you need further clarification or in case you are interested in deeper insights about pacemaker just hit me up.

---

<div class="post-metadata">

**Author:** ![Faisal\_Hassan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/faisal_hassan/32/20450_2.png) [@Faisal\_Hassan](https://forums.percona.com/u/Faisal_Hassan)\
**Post date:** [March 18, 2025, 1:20am UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/5 "2025-03-18T01:20:12Z")

</div>

Hi @Jostrus,

First of all, thanks for the references and for sharing your opinion! I appreciate the insights.

Actually, I’m new to this setup and would love to learn more about Pacemaker/Corosync.  
Could you share deeper insights on how they work in a high-availability setup? Any best practices or gotchas to watch out for?

Looking forward for your response!

---

<div class="post-metadata">

**Author:** ![Jostrus](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jostrus](https://forums.percona.com/u/Jostrus)\
**Post date:** [March 18, 2025, 9:35pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/6 "2025-03-18T21:35:04Z")

</div>

Hey @Faisal_Hassan,  
best practice for a pacemaker/corosync setup is quorum but can also be configured for a two node setup but isn’t recommended. Here you have to check stonith (shoot the other node in the head) and set quorum policy to ignore for a two node cluster.

As always you can also setup a witness node in case you don’t want a third node that can take over the whole traffic.

Lastly that i can think of is a dedicated NIC for Heartbeat messages but that depends on the amount of traffic that is already sending and receiving over your main NIC. It’s not required as you can still have a pretty solid setup without it but it’s definitely best practice.

Edit: One Advantage of pacemaker/corosync is the already built ocf scripts: [resource-agents/heartbeat/galera.in at main · ClusterLabs/resource-agents · GitHub](https://github.com/ClusterLabs/resource-agents/blob/main/heartbeat/galera.in)  
For example you can setup an Galera Replication with pacemaker. There are scripts for various service so it’s worth to have a look at it.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [March 20, 2025, 1:20pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/7 "2025-03-20T13:20:51Z")

</div>

Hey @Jostrus,

> [@Faisal\_Hassan](#):
>
> Pacemaker/Corosync

These two are extremely complex pieces of software, and would not be recommended as best-practices.

Since you are in AWS, the simplest solutions available to you are: an AWS Elastic Load Balancer, an Elastic IP, or an EC2 scaling group.

---

<div class="post-metadata">

**Author:** ![MKynaston](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@MKynaston](https://forums.percona.com/u/MKynaston)\
**Post date:** [October 19, 2025, 10:04pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/8 "2025-10-19T22:04:05Z")

</div>

Hi @matthewb

Sorry to reopen an old thread, but we are looking at exactly the same scenario. Three node XtraDB cluster in AWS, traffic routed through either ProxySQL or HAproxy (is there a Percona preferred option?) and are looking for the Proxy not to be the single point of failure. Is there a benefit over ELB or EC2 scaling groups?

For clarity, we expect that traffic may dictate a fourth read-only node on the XtraDB cluster (MySQL) in the short-term, and the software has been designed with that intention.

Mike

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 20, 2025, 5:47pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/9 "2025-10-20T17:47:55Z")

</div>

> [@MKynaston](#):
>
> Is there a benefit over ELB or EC2 scaling groups?

EC2 scaling groups are not really HA/failover in this sense. I think you’d be better with 2 EC2s running ProxySQL (recommended), and a ELB in front to balance traffic to ProxySQL.

---

<div class="post-metadata">

**Author:** ![MKynaston](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@MKynaston](https://forums.percona.com/u/MKynaston)\
**Post date:** [October 20, 2025, 6:09pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/10 "2025-10-20T18:09:29Z")

</div>

Thanks that was our view and plan. Presumably the EC2 for ProxySQL dont need to be big instances? I’m struggling to find anything on recommendations - memory optimised presumably again.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 22, 2025, 4:16pm UTC](https://forums.percona.com/t/percona-xtradb-cluster-8-x-setup-with-proxysql-and-keepalived-as-ha/37154/11 "2025-10-22T16:16:18Z")

</div>

> [@MKynaston](#):
>
> Presumably the EC2 for ProxySQL dont need to be big instances

Correct. Start with something like t3.xlarge, and monitor CPU/Memory usage. Don’t scale up until you need to.
