Create a TCP load balancer

It is possible to create a load balancer for almost any kind of TCP service.


Create a TCP load balancer using the control panel

It is also possible to load balance TCP traffic that is not HTTP, such as PostgreSQL servers.

To set up a load balancer for TCP, create a new listener and select tcp under Mode. Enter the TCP port the listener should listen on. Then, add the targets and their TCP ports.

In the example below, we use PostgreSQL servers behind the load balancer.

Create a TCP load balancer using the API

  1. Use the loadbalancer/create endpoint in the API to create a load balancer.

  2. To add a listener to the load balancer, use the loadbalancer/addfrontend endpoint.

  3. To add a target (server) to the load balancer, use the loadbalancer/addbackend endpoint.

  4. To add a certificate to the listener for SSL traffic, use the loadbalancer/addcertificate endpoint.

Additional load balancer endpoints are available in the loadbalancer module.

Last updated

Was this helpful?