HA Proxy and 3 node cluster - Zerpet/docker-rabbitmq-cluster GitHub Wiki

This template includes an HAProxy based on dockercloud image. The advantage of this HAProxy image is the autoconfiguration feature via envrionment variables. This image will redirect all the HTTP traffic from 8080 to the exposed ports. It allows to configure TCP redirections and to exclude ports.

The notable changes in this template is the use of the environment variables. RabbitMQ images include the following variables:

  • TCP_PORTS to 5672. This sets a specific TCP route to balance non-HTTP traffic through this port
  • EXCLUDE_PORTS to other exposed non-5672 ports. The other ports are not used by external clients (SSL disabled by default); there is no need to route those

The HAProxy image includes the variable ADDITIONAL_SERVICES. This variable must be set to the name of the other services; the format must be <project-name>:<service-name>. The project name usually is the folder containing docker-compose.yml. It can be changed using docker-compose -p project-name [...]. The service name is the name defined in the compose file, e.g. rabbitmq-worker-server1 or rabbitmq-server1.

Most of the time, the variable ADDITIONAL_SERVICES will have to be adjusted to match the project name.