Configure HAProxy for rabbitmq

I want to use HAProxy as load balancing. I want to put two rabbitmq servers for haproxy. Both rabbitmq servers are in a different instance of EC2. I am setting up a HAProxy server by following this link . I work, but the problem is that messages are not published in the roundrobin template. Messages are published on only one server. Is there any other configuration for my requirement?

My setup is in /etc/haproxy/haproxy.cfg

listen rabbitmq 0.0.0.0:5672
     mode    tcp
     stats   enable
     balance roundrobin
    option tcplog
    no  option clitcpka
    no option srvtcpka
     server  rabbit01 46.XX.XX.XX:5672 check
     server  rabbit02 176.XX.XX.XX:5672 check
listen  web-service *:80
          mode    http
         balance roundrobin
        option httpchk HEAD / HTTP/1.0
         option httpclose
        option forwardfor
        option httpchk OPTIONS /health_check.html
        stats enable
        stats refresh 10s
        stats hide-version
        stats scope   .
        stats uri     /lb?stats
        stats realm   LB2\ Statistics
        stats auth    admin:Adm1nn

Update:

I did some R&D on this and found that HAProxy cycles through the connection on the rabbitmq server. for example: if I request 10 connections, then it will combine 10 connections on my 2 rabbitmq servers and publish a message.

, robin-, , HAProxy. 1000 HAProxy, 500 1, 500 2. , ?

Update:

, HAProxy . serverfault.com

+3
3

, .

, { "x-ha-policy", "all" }. , , , , , .

. Pre Rabbit 3.0 x-ha-policy, . 3.0 (ha-mode = all). api api tools (rabbitmqctl, management gui). .

rabbitmqctl set_policy -p '/' MirrorAllQueues '.+' '{"ha-mode": "all"}'

+5

AMQP , AMQP ( ). , , HAProxy, - .

, . , , RabbitMQ, , , federation.

:

:

rabbitmq-plugins enable rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management

- RabbitMQ Admin > "Federation Upstreams" > " " (-).

/, . , , . "" > "" > "/ " , (), .

+2

" " .

- , , . backup option allbackups, , .

:

listen  rebbitmq *:5672
        mode    tcp
        balance roundrobin
        stats enable
        option  forwardfor
        option  tcpka
        server  web2 46.XX.XX.XXX:5672 check inter 5000
        server web1 176.XX.XX.XX:5672 check inter 5000
0
source

All Articles