health_check

Syntax: health_check [parameters];
Default:
Context: server

Enables periodic health checks of the servers in a group.

The following optional parameters are supported:

interval=time
sets the interval between two consecutive health checks, by default, 5 seconds.
jitter=time
sets the time within which each health check will be randomly delayed, by default, there is no delay.
fails=number
sets the number of consecutive failed health checks of a particular server after which this server will be considered unhealthy, by default, 1.
passes=number
sets the number of consecutive passed health checks of a particular server after which the server will be considered healthy, by default, 1.
match=name
specifies the match block configuring the tests that a successful connection should pass in order for a health check to pass. By default, only the ability to establish a TCP connection with the server is checked.
port=number
defines the port used when connecting to a server to perform a health check (1.9.7). By default, equals the server port.
udp
specifies that the UDP protocol should be used for health checks instead of the default TCP protocol (1.9.13); requires a match block with the send and expect parameters.

For example,

server {
    proxy_pass backend;
    health_check;
}

will check the ability to establish a TCP connection to each server in the backend group every five seconds. When a connection to the server cannot be established, the health check will fail, and the server will be considered unhealthy. Client connections are not passed to unhealthy servers.

Health checks can also be configured to test data obtained from the server. Tests are configured separately using the match directive and referenced in the match parameter.

The server group must reside in the shared memory.

If several health checks are defined for the same group of servers, a single failure of any check will make the corresponding server be considered unhealthy.

This directive is available as part of our commercial subscription.
doc_nginx
2017-02-09 07:06:25
Comments
Leave a Comment

Please login to continue.