2017-09-08 7 views
0

Je suis à la recherche d'une configuration haproxy (HAProxy version 1.5.18) qui permettra l'équilibrage de la charge websocket ainsi que l'équilibrage de charge RabbitMQ. J'ai essayé beaucoup d'options, mais aucun ne semble fonctionner, ci-dessous est mon fichier de configuration haproxy:Haproxy Sockjs Loadbalancing Websocket et équilibrage de charge RabbitMQ dans la même configuration

global 
     log   127.0.0.1 local2 

     chroot  /var/lib/haproxy 
     pidfile  /var/run/haproxy.pid 
     maxconn  4000 
     user  haproxy 
     group  haproxy 
     daemon 

     stats socket /var/lib/haproxy/stats 

    defaults 
     mode     http 
     log      global 
     option     httplog 
     option     dontlognull 
     option http-server-close 
     option forwardfor  except 127.0.0.0/8 
     option     redispatch 
     retries     3 
     timeout http-request 15s 
     timeout queue   1m 
     timeout connect   10s 
     timeout client   1m 
     timeout server   1m 
     timeout http-keep-alive 10s 
     timeout check   10s 
     maxconn     3000 
     timeout tunnel   3600s 

    frontend http_web *:80 
     mode http 
     default_backend rgw 

    backend rgw 
     balance roundrobin 
     server rgw1 173.36.22.49:8080 maxconn 10000 weight 10 cookie rgw1 check 
     server rgw2 10.42.139.69:8080 maxconn 10000 weight 10 cookie rgw2 check 

    listen stats :9000 
     mode http 
     stats enable 
     stats realm Haproxy\ Statistics 
     stats uri /haproxy_stats # Stats URI 
     stats auth websocketadmin:websocketadmin 

    listen ampq 
     bind *:61613 
     mode tcp 
     option clitcpka 
     server rabbit1 10.42.6.112:61613 check inter 1s rise 3 fall 1 
     server rabbit2 10.42.6.113:61613 check inter 1s rise 3 fall 1 
     server rabbit3 10.42.6.114:61613 check inter 1s rise 3 fall 1 
     server rabbit4 10.42.6.115:61613 check inter 1s rise 3 fall 1 

haproxy ne donne aucune erreur, il imprime le message ci-dessous, mais il ne fonctionne pas, je ne peux pas se connecter à websocket ou connectez-vous à Rabbitmq. Mais dès que j'enlève "listen ampq", tout commence à bien fonctionner.

Sep 8 21:00:40 localhost haproxy[3184]: Proxy http_web started. 
    Sep 8 21:00:40 localhost haproxy[3184]: Proxy rgw started. 
    Sep 8 21:00:40 localhost haproxy[3184]: Proxy stats started. 

Répondre

0

Le problème était le port 61613, qui a été déjà pris par un autre processus. J'ai donc dû passer à un nouveau port et l'ajouter dans les règles du pare-feu et cela fonctionne maintenant.