查看服务器java运行情况_使用haproxy对后端服务器执行http运行状况检查

是否可以在各个后端服务器上执行HTTP运行状况检查,并在活动后端服务器之间进行负载 balancer . 当我们在httpchk中提到主机名时,这适用于单后端服务器(选项httpchk GET / info HTTP / 1.1主机:\ abc.mysrv1.com)

但是我无法使用多个后端服务器成功配置它,因为我无法在httpchk命令上提供单独的主机名,并且在后端配置下获得http 400错误 -

backend svc.op

balance roundrobin

mode http

http-send-name-header Host

option httpchk GET /info HTTP/1.1

http-check send-state

http-request set-uri /test/abcService

server abc.mysrv1.com abc.mysrv1.com:80 check

server abc.mysrv2.com abc.mysrv2.com:80 check

[WARNING] 115/162226 (4788) : Server svc.op/abc.mysrv1.com is DOWN, reason: Layer7 wrong status, code: 400, info: "Bad Request: missing required Host header", check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

[WARNING] 115/162227 (4788) : Server svc.op/abc.mysrv2.com is DOWN, reason: Layer7 wrong status, code: 400, info: "Bad Request: missing required Host header", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

[ALERT] 115/162227 (4788) : backend ' svc.op' has no server available!

$ ./haproxy -version HA-Proxy版本1.6.7 2016/07/13

更新:我没有追求这个,但有人建议关注 -

backend h_a01

mode http

option httpchk GET /health HTTP/1.1\r\nHost:\ a01\r\n

http-check expect rstatus ^200

http-request set-uri /hello/world

http-request set-header Host a01

server a01 a01 check

backend h_a02

mode http

option httpchk GET /health HTTP/1.1\r\nHost:\ a02\r\n

http-check expect rstatus ^200

http-request set-uri /hello/world

http-request set-header Host a02

server a02 a02 check

backend a

mode http

option forwardfor

http-send-name-header Host

http-request set-uri /hello/world

server a1 a1 track h_a01/a01

server a2 a2 track h_a02/a02

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值