HAproxy健康检查底层应用程序

时间:2018-04-30 22:14:31

标签: nginx haproxy

我在3台服务器上使用NGINX reverproxy来密码保护应用程序。 nginx在服务器上保存端口80,应用程序在localhost端口x上运行。 nginx fwds请求从客户端端口x访问vip:vipport。

我在服务器1上有一个vip,通过keepalived获得keld,haproxy在所有3台服务器上对端口80执行LB和运行状况检查。我正在查看界面,并且取消应用程序并没有将服务器行变为红色,因为nginx端口仍在运行..有没有办法让ha准确地表示应用程序端口关闭?

#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global


    log         127.0.0.1 local0 notice         # only send important events

    chroot      /var/lib/haproxy.app
    pidfile     /var/run/haproxy.app.pid
    user        haproxy
    group       users
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy.elasticsearch/stats level admin

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    tcp
    log                     global
    option                  tcplog
    option                  dontlognull

    timeout connect         4s
    timeout server          30s
    timeout client          30s

    timeout http-request    10s
    timeout queue           30s
    timeout http-keep-alive 5s
    timeout check           5s
    maxconn                 10000

frontend front
        mode tcp
        bind ipin:vipport
        default_backend back


backend back
        balance leastconn
        source ipin
        #balance roundrobin
        #option ssl-hello-chk
        stick-table type ip size 200k expire 60m
        stick on src

        server server3 ip:80 check
        server server2 ip:80 check
        server server1 ip:80 check

listen stats
        bind *:99
        mode http
        stats enable
        stats uri /

0 个答案:

没有答案