Percona XtraDB Cluster: Automatic Failover Between Nodes in Java Spring Boot Application

I’ve set up a Percona XtraDB Cluster with two nodes, and my Java Spring Boot application is currently communicating with node1. The challenge is that when node1 goes down, the application doesn’t seamlessly switch to node2.

Do I need to make specific configurations in my Spring Boot application or the Percona XtraDB Cluster to enable automatic failover?

I want the application to intelligently switch to node2 if node1 becomes unavailable, without manual intervention. Any insights or guidance on the necessary settings or configurations would be highly appreciated.

Hi @Muhammad_Umar,
If you only have 2 nodes, then when node1 goes down, you now have a split-brain situation and node2 will refuse to answer any questions. You need a minimum of 3 nodes to survive having 1 node going away.
As for the Java side, you need to configure the connection string such that it picks node1 by default and chooses node2 if node1 goes away.

1 Like

You would need another service in order to load balance the query traffic among the remaining Percona XtraDB Cluster members. See the Percona Docs for how to set up query routing using ProxySQL:

Another helpful blog post