I have three identical servers in terms of hardware and OS setup (Ubuntu 22.04). Each of these servers/nodes are running my Java application and each are also a PXC node. Following best practices for PXC, I want one node to receive read/write queries from my Java app instances and the other two to receive read queries.
Instead of coding the database selection in my Java application and manually handling failures, it seems like a good idea to put ProxySQL in front of the PXC nodes and let it handle read/write segmentation and failover. To keep satisfactory high availability, I must install ProxySQL on each machine and configure the Java app to connect to the local ProxySQL instance instead of the local PXC instance.
To achieve this, I assume I must set up the ProxySQL instances to operate in a cluster, so that the ProxySQL instances can automatically agree on which PXC node is the new writer, in case a PXC writer node is taken down. But in my case, with three equal nodes, should I set them all as “Core” nodes of the ProxySQL cluster?
For the configuration of the ProxySQL instances, I assume I can follow your Load Balance with ProxySQL guide to set up load balancing on each node, but the next steps are a bit confusing to me and I found the information at ProxySQL Cluster - ProxySQL somewhat difficult to follow.
Question:
How do I set the ProxySQL instances to communicate in a cluster and agree on one PXC node for read/write and the other two for reads, while also agreeing on which PXC node to “promote” in case the read/write node goes down?
I looked at Percona Scheduler Admin and the ProxySQL Admin, which both seemed relevant, but I couldn’t figure out how to use them for my use case.