Load Balancer and Droplet synchronization

July 3, 2019 228 views
DigitalOcean Load Balancing Ubuntu 18.04

Hi, a beginner question on the load balancer. I read the documentation but some information escapes me.

I have 2 droplets in the private network (ubuntu 18.04):

  • one for the web server
  • one for mysql

I want them both to have a load balancer, so I'd buy 2.

Do I have to buy 2 identical droplets (same CPU, RAM, SSD)?

On both droplets the information changes continuously: do you have to manually synchronize the droplet and its "clone" in load balancing? If yes, how?

If I add a block storage volume to the first droplet to manage the "var / www" folder, do I need to add and sync a volume on the clone as well?

2 Answers

Hello,

I'll try to answer your questions in order:

  • If you are going to be using just a standard round robin load balancing with the same weight and priority, I would recommend using identical droplets
  • If you mount your /var/www folder on a shared storage, then the two droplets would have the same files and you would not have to do the synchronization manually

That is pretty much it for the web servers. Just make sure that you have some kind of caching like redis to save your sessions in so that your users don't loose their sessions everytime they are forwarded to a different droplet.

If you want to load balance your SQL servers as well, then things get a bit more challenging. You could try using standard master to master replication but be aware of dead locks.. Or you could try using something like a Galera cluster instead. Here's how to setup those:

Galera Cluster on Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-configure-a-galera-cluster-with-mariadb-on-ubuntu-18-04-servers

Galera Cluster on Centos 7:
https://bobbyiliev.com/blog/galera-cluster-mariadb-10-1-on-centos-7-server

Hope that this helps!

Bobby

by bsder
In this guide, you will configure an active-active MariaDB Galera cluster. For demonstration purposes, you will configure and test three Ubuntu 18.04 Droplets that will act as nodes in the cluster. MariaDB is an open source relational database system that is fully compatible with the popular MySQL RDBMS system. Galera is a database clustering solution that enables you to set up multi-master clusters using synchronous replication.

Thanks Bobby, very clear.

If I want to create a complete failover for the web server droplet (classic Droplet with Plesk), what strategy do you recommend?
Is there anything similar to the cluster we created for the database?

  • Hey,

    Usually with a plain server running only let's say Apache and PHP you could just use a shared storage or a service like Lsyncd to sync your files.

    However with a control panel things get a bit more complicated as there are a lot of other services and automated tasks involved. But as far as I can see with Plesk there is a multi-server setup that you could try:

    https://docs.plesk.com/en-US/onyx/multi-server-guide/77387/

    I've not personally used it but their documentation seems OK.

    Regards,
    Bobby

Have another answer? Share your knowledge.