keepalived+haproxy节点都是down状态求解

回复 收藏
使用redhat 6.5配置keepalived+haproxy,
node主:master
node备:backup
后端服务器1:web
后端服务器2:web2
虚拟Ip

两个节点的keepalived配置文件如下:
! Configuration File for keepalived

vrrp_script chk_http_port {
script "/etc/keepalived/check_haproxy.sh"
interval 2
weight 2

global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
mcast_src_ip 10.10.13.248
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}

track_script {
chk_http_port
}

virtual_ipaddress {
10.10.13.252
}
}
}
两个节点#!/bin/bash
A=`ps -C haproxy --no-header |wc -l`
if [ $A -eq 0 ];then
/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/conf/haproxy.cfg
sleep 3
if [ `ps -C haproxy --no-header |wc -l` -eq 0 ];then
/etc/init.d/keepalived stop
fi
fi
的脚本文件如下:

两节点的haproxy配置文件如下:
global
log 127.0.0.1 local3 err
maxconn 4096
user nobody
group nobody
daemon
nbproc 1
pidfile /usr/local/haproxy/logs/haproxy.pid

defaults
maxconn 2000
contimeout 5000
clitimeout 30000
srvtimeout 30000
mode http
log global
log 127.0.0.1 local3 err
stats uri /admin?stats
option forwardfor

frontend www
bind *:80
acl test.domain.com hdr_dom(host) -i test.domain.com
acl test.com hdr_dom(host) -i test.com
use_backend web if test.domain.com
use_backend web2 if test.com

backend web
#balance roundrobin
mode http
balance roundrobin
option httpchk /index.html
server web 10.10.13.239:80 check inter 5000 fall 3


backend web2
mode http
balance roundrobin
#balance source
option httpchk /index.html
server web2 10.10.13.238:80 check inter 5000 fall 3


当然主从相应的位置都会更改相应的值。现在问题是这样:

主节点上ping两台web服务器都能通,但是telnet web服务器的80端口不通,然后haproxy的监控页面的状态那都是down
haproxy的日志如下:


2016-09-07T16:43:17+08:00 localhost haproxy[54509]: Server web/web is DOWN, reason: Layer7 wrong status   , code: 405, info: "Not Allowed", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions a   ctive, 0 requeued, 0 remaining in queue.
2016-09-07T16:43:17+08:00 localhost haproxy[54509]: Server web/web is DOWN, reason: Layer7 wrong status   , code: 405, info: "Not Allowed", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions a   ctive, 0 requeued, 0 remaining in queue.
2016-09-07T16:43:17+08:00 localhost haproxy[54509]: backend web has no server available!
2016-09-07T16:43:17+08:00 localhost haproxy[54509]: backend web has no server available!
2016-09-07T16:43:19+08:00 localhost haproxy[54510]: Server web2/web2 is DOWN, reason: Layer7 wrong stat   us, code: 405, info: "Not Allowed", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions    active, 0 requeued, 0 remaining in queue.
2016-09-07T16:43:19+08:00 localhost haproxy[54510]: Server web2/web2 is DOWN, reason: Layer7 wrong stat   us, code: 405, info: "Not Allowed", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions    active, 0 requeued, 0 remaining in queue.
2016-09-07T16:43:19+08:00 localhost haproxy[54510]: backend web2 has no server available!
2016-09-07T16:43:19+08:00 localhost haproxy[54510]: backend web2 has no server available!
2016-09-07 17:01 举报
已邀请:
0

HWQH - 学习,学习!赚钱,赚钱!

赞同来自:

哥们我的建议,如果英文不懂你可以下个翻译软件,很多问题日志写的很详细,师傅领进门修行看个人
0

riverxyz

赞同来自:

我知道日志写的很清楚,是7层不允许,web的服务不可用,但是我不知道怎么解决。
0

阿铭 管理员

赞同来自:

telnet 80 不通,这肯定不行啊,先把80搞通了啊。 检查iptables规则。

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: