HaProxy 给予 - 503 服务不可用

Nar*_*dra 6 ssl https load-balancing haproxy

我正在使用以下配置为两个 Tomcat 服务器执行负载平衡。我将 HAProxy 配置为执行 SSL/TLS 桥接/重新加密。

#------------------------------------------------- --------------------
# 可能的 Web 应用程序的示例配置。见
# 在线完整配置选项。
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#------------------------------------------------- --------------------

#------------------------------------------------- --------------------
# 全局设置
#------------------------------------------------- --------------------
全球的
    # 要让这些消息最终出现在 /var/log/haproxy.log 中,您将
    # 需要:
    #
    # 1) 配置syslog 以接受网络日志事件。这个做完了
    # 通过在 SYSLOGD_OPTIONS 中添加“-r”选项
    # /etc/sysconfig/syslog
    #
    #2) 配置local2事件到/var/log/haproxy.log
    # 文件。可以添加如下一行
    # /etc/sysconfig/syslog
    #
    # local2.* /var/log/haproxy.log
    #
    日志 127.0.0.1 local2 调试

    chroot /var/lib/haproxy
    pidfile /var/run/haproxy.pid
    最大康 4000
    用户haproxy
    组haproxy
    守护进程

    # 打开 stats unix 套接字
    统计套接字/var/lib/haproxy/stats
    ssl-server-verify 无

#------------------------------------------------- --------------------
# 所有'listen' 和'backend' 部分的通用默认值
# 如果未在其块中指定则使用
#------------------------------------------------- --------------------
默认值
    模式http
    登录全局
    选项 httplog
    选项 dontlognull
    选项 http-server-close
    选项 forwardfor 除了 127.0.0.0/8
    选项重新调度
    重试 3
    超时http-request 10s
    超时队列 1m
    超时连接 10s
    超时客户端 1m
    超时服务器 1m
    超时 http-keep-alive 10s
    超时检查 10s
    最大康 3000

#------------------------------------------------- --------------------
# 代理后端的主前端
#------------------------------------------------- --------------------
前端 ft_main
default_backend bk_main
绑定 192.168.192.175:443 ssl crt /home/testuser/Software/apache-tomcat-7.0.32/keystore/haproxy-cert.pem no-sslv3
模式http

#------------------------------------------------- --------------------
# 各个后端之间的循环平衡
#------------------------------------------------- --------------------
后端 bk_main
    平衡循环
    重试 3
server srv01 192.168.192.173:8443 weight 1 maxconn 100 check no-sslv3 ssl verify none 
server srv01 192.168.192.174:8443 weight 1 maxconn 100 check no-sslv3 ssl verify none 

当我启动服务时出现以下错误

8 月 17 日 17:06:12 来自 syslogd@localhost 的消息...
 haproxy[2593]: 后端 bk_main 没有可用的服务器!

我正在观察 /var/log/haproxy.log 中的以下日志

8 月 17 日 16:52:07 localhost haproxy[2495]:后端 bk_main 没有可用的服务器!
8 月 17 日 16:52:25 localhost haproxy[2496]: 120.117.50.250:52088 [17/Aug/2015:16:52:25.084] ft_main~bk_main/556/-1/-1/-50325 - SC-- 1/1/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:26 本地主机 haproxy[2496]: 120.117.50.250:52089 [17/Aug/2015:16:52:25.336] ft_main~ bk_main/1044/-1/-1/-1203 - - SC-- 0/0/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:27 localhost haproxy[2496]: 120.117.50.250:52090 [17/Aug/2015:16:52:27.371] ft_main~ bk_main/268/-1/-1/-50326 - SC-- 1/1/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:28 localhost haproxy[2496]: 120.117.50.250:52091 [17/Aug/2015:16:52:27.623] ft_main~bk_main/671/-1/-1/-50372 - SC-- 0/0/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:29 localhost haproxy[2496]: 120.117.50.250:52092 [17/Aug/2015:16:52:29.395] ft_main~bk_main/273/-1/-1/-50373 - SC-- 1/1/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:30 localhost haproxy[2496]: 120.117.50.250:52093 [17/Aug/2015:16:52:29.646] ft_main~ bk_main/701/-1/-1/-50/301 - SC-- 0/0/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:52:51 localhost haproxy[2496]: 120.117.50.250:52094 [17/Aug/2015:16:52:51.268] ft_main~bk_main/274/-1/-1/-50327 - SC-- 1/1/0/0/0 0/0 "GET /test/healcheck.jsp HTTP/1.1"
8 月 17 日 16:57:15 localhost haproxy[2496]: 192.168.192.168:54329 [17/Aug/2015:16:57:15.560] ft_main/1: SSL 握手失败
8 月 17 日 17:00:34 localhost haproxy[2538]:代理 ft_main 启动。
8 月 17 日 17:00:34 localhost haproxy[2538]:代理 bk_main 启动。
8 月 17 日 17:00:34 localhost haproxy[2538]:服务器 bk_main/srv01 关闭,原因:Layer6 无效响应,信息:“SSL 握手失败”,检查持续时间:30 毫秒。0 个活动服务器和 0 个备用服务器。0 个会话处于活动状态,0 个重新排队,0 个剩余在队列中。
8 月 17 日 17:00:34 localhost haproxy[2538]:后端 bk_main 没有可用的服务器!
8 月 17 日 17:06:12 localhost haproxy[2593]:代理 ft_main 启动。
8 月 17 日 17:06:12 localhost haproxy[2593]:代理 bk_main 启动。
8 月 17 日 17:06:12 localhost haproxy[2593]:服务器 bk_main/srv01 关闭,原因:第 6 层无效响应,信息:“SSL 握手失败”,检查持续时间:25 毫秒。0 个活动服务器和 0 个备用服务器。0 个会话处于活动状态,0 个重新排队,0 个剩余在队列中。
8 月 17 日 17:06:12 localhost haproxy[2593]:后端 bk_main 没有可用的服务器!

基于上述标志中存在的“SC”标志,我的理解是它无法建立服务器连接。那么这是握手问题吗?我正在使用自签名证书。在服务器指令中我提到了“不验证”,那么问题是什么?

Mik*_*rry 0

检查您的 /etc/hosts 文件并确保您的实例名称与您代理的实例名称不同。一般将服务器的主机名设置为127.0.0.1