Add proactive health check for the upstream servers.
This module is not built by default before Tengine-1.4.0,
it should be enabled with the
--with-http_upstream_check_module configuration parameter.
interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [default_down=true|false] [type=tcp|http|ssl_hello|mysql|ajp] [port=check_port]
Default: If the parameters are omitted, default values are:
interval=30000 fall=5 rise=2 timeout=1000 default_down=true type=tcp>
Add health check for the upstream servers.
The parameters' meanings are:
interval: the check request's interval time.
fall(fall_count): After fall_count failure checks, the server is marked down.
rise(rise_count): After rise_count successful checks, the server is marked up.
timeout: the check request's timeout.
default_down: specify initial state of backend server, default is down.
type: the check protocol type:
tcp: a simple TCP socket connect and peek one byte.
ssl_hello: send a client SSL hello packet and receive the server SSL hello packet.
http: send a http request packet, receive and parse the http response to diagnose if the upstream server is alive.
mysql: connect to the mysql server, receive the greeting response to diagnose if the upstream server is alive.
ajp: send an AJP Cping packet, receive and parse the AJP Cpong response to diagnose if the upstream server is alive.
port: specify the check port in the backend servers. It can be different with the original servers port. Default the port is 0 and it means the same as the original backend server. This option is added after tengine-1.4.0.
The directive specifies the number of requests sent on a connection, the default vaule 1 indicates that tengine will certainly close the connection after a request.
"GET / HTTP/1.0\r\n\r\n"
If the check type is http, the check function will send this http packet to the upstream server. Method "HEAD" is recommended for reducing traffic.
When persistant connection is used, a keep-alive request header should be added to the value of the directive, e.g.
"HEAD / HTTP/1.1\r\nConnection: keep-alive\r\n\r\n".
In addition, in the case of "GET" method, size of the request uri should not be too large, make sure the transmission can be finished within an
interval, otherwise the health check will deduce a conclusion that there is something wrong with the servers or the net.
[ http_2xx | http_3xx | http_4xx | http_5xx ]
http_2xx | http_3xx
These status codes indicate the upstream server's http response is OK and the check response is successful.
Default size is one megabytes. If you want to check thousands of servers, the shared memory may be not enough, you can enlarge it with this directive.
Display the status of checking servers. This directive should be used in the http block.
You can specify the default display format after Tengine-1.4.0. The formats can be
json. The default type is
html. It also supports to specify the format by the request argument. Suppose your
check_status location is '/status', the argument of
format can change the display page's format. You can do like this:
At present, you can fetch the list of servers with the same status by the argument of
status. For example:
Below it's the sample html page:
Below it's the sample of csv page:
Below it's the sample of json page: