我可能使用了错误的术语进行搜索,但我无法通过HAProxy完成与后端服务器的连接。我最初能够登录到服务器,但随后应用程序也通过另外两个端口进行通信。我可以直接转到其中一个服务器,它会正确地登录并启动应用程序。但是,通过HAProxy,我可以进行身份验证,然后我就会得到一个通信错误。我认为HAProxy没有在其他端口上传递数据。如何才能做到这一点?
我的设置:
2台HAProxy服务器连接到2台完全相同的VM服务器。就告知机器上的服务何时运行而言,HAProxy似乎工作正常。它正在通过端口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发布于 2017-05-10 23:35:12
在您的vm-port-3000中,您实际上绑定到了端口5432,而不是您打算绑定到端口3000的样子。
因此,到端口5432的请求由vm-port-3000或vm-port-5432侦听器随机处理,而到端口3000的连接根本不由HAProxy处理。
https://stackoverflow.com/questions/43831657
复制相似问题