Load Balancers support TCP balancing for applications that do not speak HTTP. For example, deploying a Load Balancer in front of a database cluster lets you spread requests across all available machines.
To set up TCP balancing for a Galera cluster, you’ll need:
A TCP application, like a Galera cluster spanning several Droplets.
If you use Galera, you’ll need to configure remote access to the database and create a remote user that has full access to that database. This ensures the Load Balancer will be able to connect; because Load Balancers are a highly available service with automatic failover, connections coming from it may not always originate from the same IP address.
The details of your backend configuration will depend on what software you’re using.
In the Add Droplets section, choose all three of the Galera Droplets. This will also automatically select the region for your Load Balancer.
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.
Next, click on the Edit Advanced Settings button within the Advanced settings section:
In the expanded interface, in 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.
When you are finished, click the Create Load Balancer button. Once the Load Balancer is available, you can connect to your application by connecting to the Load Balancer. You can find your Load Balancer’s public IP address by visiting the Load Balancer index page.