我正在使用下面的configuration为两台Tomcat服务器执行负载平衡。 我configurationHAProxy来执行SSL / TLS桥接/重新encryption。
#------------------------------------------------- -------------------- #可能的web应用程序的configuration示例。 看到了 #在线完整configuration选项。 # #http://haproxy.1wt.eu/download/1.4/doc/configuration.txt # #------------------------------------------------- -------------------- #------------------------------------------------- -------------------- # 全局设置 #------------------------------------------------- -------------------- 全球 #将这些消息放在/var/log/haproxy.log中 # 需要: # #1)configurationsyslog接受networking日志事件。 这个做完了 #join'-r'选项到SYSLOGD_OPTIONS中 #/ etc / sysconfig / syslog # #2)configurationlocal2事件去到/var/log/haproxy.log #文件。 可以添加如下所示的行 #/ etc / sysconfig / syslog # #local2。* /var/log/haproxy.log # 日志127.0.0.1 local2debugging chroot / var / lib / haproxy pidfile /var/run/haproxy.pid maxconn 4000 用户haproxy 组haproxy 守护进程 #打开统计unix套接字 统计socket / var / lib / haproxy / stats ssl-server-verify none #------------------------------------------------- -------------------- #所有的“听”和“后端”部分将默认#默认 #使用,如果没有指定在他们的块 #------------------------------------------------- -------------------- 默认 模式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 maxconn 3000 #------------------------------------------------- -------------------- #主要前端代理到后端 #------------------------------------------------- -------------------- 前端ft_main default_backend bk_main bind 192.168.192.175:443 ssl crt /home/testuser/Software/apache-tomcat-7.0.32/keystore/haproxy-cert.pem no-sslv3 模式http #------------------------------------------------- -------------------- #各种后端之间的循环平衡 #------------------------------------------------- -------------------- 后端bk_main 平衡roundrobin 重试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没有可用的服务器! Aug 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 / -1 / 556 503 212 - - SC_ 1/1/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 17 16:52:26 localhost haproxy [2496]:120.117.50.250:52089 [17 / Aug / 2015:16:52:25.336] ft_main〜bk_main / 1044 / -1 / -1 / -1 / 1044 503 212 - - SC_0/0/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 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 / -1 / 268 503 212 - - SC_ 1/1/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 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 / -1 / 671 503 212 - - SC_0/0/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 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 / -1 / 273 503 212 - - SC_ 1/1/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 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 / -1 / 701 503 212 - - SC_0/0/0/0/0 0/0“GET /test/healcheck.jsp HTTP / 1.1” Aug 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 / -1 / 274 503 212 - - 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]:Proxy bk_main开始。 8月17日17:00:34 localhost haproxy [2538]:服务器bk_main / srv01为DOWN,原因:Layer6无效,info:“SSL握手失败”,检查持续时间:30ms。 剩下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]:Proxy bk_main开始。 8月17日17:06:12 localhost haproxy [2593]:服务器bk_main / srv01为DOWN,原因:Layer6无效响应,info:“SSL握手失败”,检查持续时间:25ms。 剩下0个活动和0个备份服务器。 0个会话处于活动状态,0个处于活动状态,0个在队列中。 Aug 17 17:06:12 localhost haproxy [2593]:后端bk_main没有可用的服务器!
基于上面标志中出现的“SC”标志,我的理解是无法build立服务器连接。 那么这是一个握手问题? 我正在使用自签名证书。 而在服务器指令中,我提到“validation没有”,那么可能是什么问题?
检查你的/ etc / hosts文件,并确保你的实例名称与你正在代理的不一样。 通常它将服务器的主机名设置为127.0.0.1