2017-05-07 75 views
0

我可能會使用錯誤的術語進行搜索,但我無法通過HAProxy完成與後端服務器的連接。我能夠最初登錄到服務器,但是應用程序也通過另外兩個端口進行通信。我可以直接進入其中一臺服務器,並登錄並正確執行應用程序。然而,通過HAProxy,我可以進行身份​​驗證,然後出現通信錯誤。我在考慮HAProxy沒有通過其他端口上的數據。這怎麼能實現?HAProxy Multiport後端

我的設置:連接到2個相同VM服務器

2 HAProxy的服務器。 HAProxy似乎正在正確地工作,只要告訴mcahines上的服務何時運行。它正在通過8443端口的認證。但是,就這一點而言。它不會啓動使用端口3000和5432的VM。有關HAProxy設置的任何想法?

這裏是我的配置文件:

global 
    ssl-server-verify none 
    tune.ssl.default-dh-param 2048 
    maxconn 256 

defaults 
    log global 
    mode http 
    option httplog 
    option dontlognull 
    retries 3 
    option redispatch 
    timeout connect 5000 
    timeout client 10000 
    timeout server 10000 

    errorfile 400 /etc/haproxy/errors/400.http 
    errorfile 403 /etc/haproxy/errors/403.http 
    errorfile 408 /etc/haproxy/errors/408.http 
    errorfile 500 /etc/haproxy/errors/500.http 
    errorfile 502 /etc/haproxy/errors/502.http 
    errorfile 503 /etc/haproxy/errors/503.http 
    errorfile 504 /etc/haproxy/errors/504.http 

listen vm-port-3000 
    bind *:5432 

    server qvd4 10.0.0.1:3000 
    server qvdnode02 10.0.0.2:3000 

listen vm-port-5432 
    bind *:5432 

    server qvd4 10.0.0.1:5432 
    server qvdnode02 10.0.0.2:5432 

listen stats 
    bind :1936 

    stats enable 
    stats hide-version 
    stats realm Loadbalanced\ Servers 
    stats uri /haproxy?stats 
    stats auth haproxy:haproxy 


frontend vm-initial-conn 
    bind *:8443 ssl crt /etc/ssl/certs/qvd/haproxy.pem 

    default_backend vmConn 

backend vmConn 
    option forwardfor 
    option httpchk GET /qvd/ping HTTP/1.1 
    http-check expect status 200 
    balance roundrobin 

    http-request add-header X-Forwarded-Proto https if { ssl_fc } 
    http-request set-header X-Forwarded-Port %[dst_port] 

    server qvd4 10.0.0.1:8443 ssl verify none check 
    server qvdnode02 10.0.0.2:8443 ssl verify none check 
+0

其實,我不認爲這跟不同的港口有什麼關係。出於某種原因,HAProxy會超時。仍在調查。 –

回答

0

在你vm-port-3000你實際上是綁定到端口5432,而不是它如何出現你打算端口3000

因此,請求到端口5432的隨機由您的vm-port-3000或您的vm-port-5432偵聽器處理,而到端口3000的連接根本不由HAProxy處理。