DigitalOcean fully manages Regional Load Balancers and Global Load Balancers, ensuring they are highly available load balancing services. Load balancers distribute traffic to groups of backend resources in specific regions or across different regions, which prevents the health of a service from depending on the health of a single server, cluster, or region.
Regional load balancers support TCP balancing for applications that do not speak HTTP. To set up TCP balancing, you need:
A TCP application, like a Galera cluster spanning several Droplets. The details of your backend configuration depend on what software you’re using.
A DigitalOcean Load Balancer with those Droplets added to its backend.
To configure the load balancer to balance TCP, you need to add a TCP forwarding rule and a TCP health check.
From the control panel, click Networking, then click Load Balancers to go to the load balancer index page. From there, click your load balancer’s name to view its detail page.
On the detail page, click Settings.
In the Forwarding rules section, modify the existing rule by clicking the drop down menu in the first field and changing it from HTTP to TCP.
Change the port in both the Load Balancer side and the Droplet side from 80 to the listening port of your application. For example, when using a Galera cluster, use the MariaDB port 3306.
When you’re done, click Save.
On the same settings page, open the Health checks section. An HTTP health check is defined by default.
Modify the health check by choosing TCP from the drop down in the first field. In the Port field, change the value from 80 to the listening port of your application.
Click Save to implement the change.