Load balance and fail over for MySQL droplets

Posted March 19, 2014 5.1k views
I'm looking for recommendations on how I could load balance two MySQL droplets. I have multiple droplets that will connect to these two droplets and there may be more than two eventually. Data replication is already setup but I'm unsure of how I could get my droplets to send the load between the two and have fail over. By the way, I'm using the Percona XtraDB Cluster. Thanks for any help.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers
I have not personally attempted something similar with mysql but. If I were going to try this, I would think about putting a load balancer server between mysql instances and the droplets that will connect to them. Perhaps something like HA proxy. We configure this proxy by telling it what its backends are and when to connect to each(perhaps a round robin) And then all your droplets would connect to the proxy server without caring how many sql you have.

When you want to add an additional mysql, it's a simple matter of settign up the replication, and adding its ip to the proxy list of backends so that it includes it as a possible reference...