I've set up a 3 node RabbitMQ cluster in docker using the following,
docker run -d --rm --net rabbits `
-v ${PWD}/config/rabbit-1/:/config/ `
-e RABBITMQ_CONFIG_FILE=/config/rabbitmq `
-e RABBITMQ_ERLANG_COOKIE=WIWVHCDTCIUAWANLMQAW `
--hostname rabbit-1 `
--name rabbit-1 `
-p 8081:15672 `
-p 8084:5672 `
rabbitmq:3.8-management
My docker network name is rabbits. I'm struggling to setup a docker HAProxy load balancer for this cluster. I'm a complete novice in both docker and load balancing, so the config file doesn't make much sense to me. The following is my current haproxy.config,
global
debug
defaults
log global
mode tcp
timeout connect 5000
timeout client 50000
timeout server 50000
frontend main
bind *:8089
default_backend app
backend app
balance roundrobin
mode http
server rabbit-1 172.18.0.2:8084
server rabbit-2 172.18.0.3:8085
server rabbit-3 172.18.0.4:8086
The 172.18.0.* is my RabbitMQ nodes IP address, I'm not sure if I'm supposed to give the ip address or the network name in the backend app. And I'm not sure about the mode as well. What I'm trying to achieve is have my client 3 node microservice application send/receive messages through amqp://guest:guest@loadbalancer:5672 URL. Please help me out.