By adam177966
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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. <br> <br>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…
We have an article on how to set up MySQL failover using HAProxy: <a href=“https://www.digitalocean.com/community/articles/how-to-use-haproxy-to-set-up-mysql-load-balancing--3”>https://www.digitalocean.com/community/articles/how-to-use-haproxy-to-set-up-mysql-load-balancing--3</a>.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.