2017-09-08 2 views
0

Ich bin auf der Suche nach einer haproxy (HAProxy Version 1.5.18) Konfiguration, die sowohl das Load Balancing als auch den RabbitMQ Lastausgleich ermöglicht. Ich habe viele Möglichkeiten ausprobiert, aber keiner scheint, ist meine Datei haproxy Config unten zu arbeiten:Haproxy Sockjs Websocket Loadbalancing und RabbitMQ Loadbalancing in derselben Konfiguration

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 keine Fehler nicht geben, es gibt die folgende Meldung, aber es funktioniert nicht, ich kann keine Verbindung zu Websocket oder verbinden mit Rabbitmq. Aber sobald ich "listen ampq" entfernen, fängt alles gut an.

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. 

Antwort

0

Das Problem war die Port 61613, die bereits von einem anderen Prozess gemacht. Also musste ich zu einem neuen Port wechseln und ihn in die Firewall-Regeln einfügen und es funktioniert jetzt.

Verwandte Themen