In this section, we use service discovery to create a web service that has multiple backend nodes with HAProxy frontend and then load balancing the service requests. HAProxy is a commonly used load balancer for TCP and HTTP-based applications.
Let's start by understanding a typical HAProxy configuration. We are not going to cover the HAProxy configuration exhaustively, but will only concentrate on the configurations that are relevant for service discovery:
frontend testloadbalancer bind *:80 mode http balance roundrobin server testserver01 172.17.18.101:80 check server testserver02 172.17.18.102:80 check
This configuration instructs HAProxy to bind to port 80
and forward HTTP traffic to the servers 172.17.18.10
and 172.17.18.102
in a round robin fashion. When we have information on every backend server, we can configure HAProxy statically and the setup will work. But imagine a scenario where the information on the IP is not available. For...