# HG changeset patch # User Yaroslav Zhuravlev # Date 1490374133 -10800 # Node ID 6b6d0e844bf748ad0c4d45cfb36ee60566dccd6a # Parent 37df1535ea91bacba9e3ac96efbf677a03db2d0f Moved "health_check" and "match" to ngx_stream_upstream_hc_module. diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/en/GNUmakefile --- a/xml/en/GNUmakefile Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/en/GNUmakefile Fri Mar 24 19:48:53 2017 +0300 @@ -113,6 +113,7 @@ stream/ngx_stream_ssl_module \ stream/ngx_stream_ssl_preread_module \ stream/ngx_stream_upstream_module \ + stream/ngx_stream_upstream_hc_module \ stream/stream_processing \ ngx_google_perftools_module \ dev/development_guide \ diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/en/docs/http/ngx_http_status_module.xml --- a/xml/en/docs/http/ngx_http_status_module.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/en/docs/http/ngx_http_status_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -9,7 +9,7 @@ + rev="16">
@@ -961,7 +961,7 @@ checks The total number of -health check +health check requests made. @@ -980,7 +980,7 @@ Boolean indicating if the last health check request was successful and passed -tests. +tests. diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/en/docs/index.xml --- a/xml/en/docs/index.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/en/docs/index.xml Fri Mar 24 19:48:53 2017 +0300 @@ -8,7 +8,7 @@
@@ -591,6 +591,11 @@ ngx_stream_upstream_module + + +ngx_stream_upstream_hc_module + + diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/en/docs/stream/ngx_stream_upstream_hc_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/stream/ngx_stream_upstream_hc_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -0,0 +1,309 @@ + + + + + + + + +
+ + +The ngx_stream_upstream_hc_module module (1.9.0) +allows enabling periodic health checks of the servers in a +group. +The server group must reside in the +shared memory. + + + + +This module is available as part of our +commercial subscription. + + + +
+ + +
+ + + +upstream tcp { + zone upstream_tcp 64k; + + server backend1.example.com:12345 weight=5; + server backend2.example.com:12345 fail_timeout=5s slow_start=30s; + server 192.0.2.1:12345 max_fails=3; + + server backup1.example.com:12345 backup; + server backup2.example.com:12345 backup; +} + +server { + listen 12346; + proxy_pass tcp; + health_check; +} + + + +
+ + +
+ + +[parameters] + +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. + + + +mandatory + + +sets the initial “checking” state for a server +until the first health check is completed (1.11.7). +If the parameter is not specified, +the server will be initially considered healthy. + + + +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, for TCP, only the ability +to establish a TCP connection with the server is checked. +For UDP, the absence of +ICMP “Destination Unreachable” message is expected +in reply to the sent string “nginx health check”. + +Prior to version 1.11.7, by default, UDP health check +required a match block with the +send and expect +parameters. + + + + +port=number + + +defines the port used when connecting to a server +to perform a health check (1.9.7). +By default, equals the + port. + + + +udp + + +specifies that the UDP protocol should be used for +health checks instead of the default TCP protocol (1.9.13). + + + + + + +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 +and servers in the “checking” state. + + + +Health checks can also be configured to test data obtained from the server. +Tests are configured separately using the 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. + + + + + + +timeout +5s +stream +server + + +Overrides the + +value for health checks. + + + + + + +name + +stream + + +Defines the named test set used to verify server responses to health checks. + + + +The following parameters can be configured: + + + +send string; + + +sends a string to the server; + + + +expect string | +~ regex; + + +a literal string (1.9.12) or a regular expression +that the data obtained from the server should match. +The regular expression is specified with the preceding +“~*” modifier (for case-insensitive matching), or the +“~” modifier (for case-sensitive matching). + + + +Both send and expect parameters +can contain hexadecimal literals with the prefix “\x” +followed by two hex digits, for example, “\x80” (1.9.12). + + + +Health check is passed if: + + +the TCP connection was successfully established; + + + +the string from the send parameter, +if specified, was sent; + + + +the data obtained from the server matched the string or regular expression +from the expect parameter, if specified; + + + +the time elapsed does not exceed the value specified +in the directive. + + + + + + +Example: + +upstream backend { + zone upstream_backend 10m; + server 127.0.0.1:12345; +} + +match http { + send "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n"; + expect ~ "200 OK"; +} + +server { + listen 12346; + proxy_pass backend; + health_check match=http; +} + + + + + +Only the first + +bytes of data obtained from the server are examined. + + + + + +
+ +
diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/en/docs/stream/ngx_stream_upstream_module.xml --- a/xml/en/docs/stream/ngx_stream_upstream_module.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/en/docs/stream/ngx_stream_upstream_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -9,7 +9,7 @@ + rev="25">
@@ -46,7 +46,8 @@ -Dynamically configurable group, +Dynamically configurable group with +periodic health checks is available as part of our commercial subscription: @@ -297,7 +298,7 @@ sets the time during which the server will recover its weight from zero to a nominal value, when unhealthy server becomes -healthy, +healthy, or when the server becomes available after a period of time it was considered unavailable. Default value is zero, i.e. slow start is disabled. @@ -491,271 +492,6 @@ - - -[parameters] - -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. - - - -mandatory - - -sets the initial “checking” state for a server -until the first health check is completed (1.11.7). -If the parameter is not specified, -the server will be initially considered healthy. - - - -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, for TCP, only the ability -to establish a TCP connection with the server is checked. -For UDP, the absence of -ICMP “Destination Unreachable” message is expected -in reply to the sent string “nginx health check”. - -Prior to version 1.11.7, by default, UDP health check -required a match block with the -send and expect -parameters. - - - - -port=number - - -defines the port used when connecting to a server -to perform a health check (1.9.7). -By default, equals the port. - - - -udp - - -specifies that the UDP protocol should be used for -health checks instead of the default TCP protocol (1.9.13). - - - - - - -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 -and servers in the “checking” state. - - - -Health checks can also be configured to test data obtained from the server. -Tests are configured separately using the 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. - - - - - - - -timeout -5s -stream -server - - -Overrides the - -value for health checks. - - - - -This directive is available as part of our -commercial subscription. - - - - - - - -name - -stream - - -Defines the named test set used to verify server responses to health checks. - - - -The following parameters can be configured: - - - -send string; - - -sends a string to the server; - - - -expect string | -~ regex; - - -a literal string (1.9.12) or a regular expression -that the data obtained from the server should match. -The regular expression is specified with the preceding -“~*” modifier (for case-insensitive matching), or the -“~” modifier (for case-sensitive matching). - - - -Both send and expect parameters -can contain hexadecimal literals with the prefix “\x” -followed by two hex digits, for example, “\x80” (1.9.12). - - - -Health check is passed if: - - -the TCP connection was successfully established; - - - -the string from the send parameter, -if specified, was sent; - - - -the data obtained from the server matched the string or regular expression -from the expect parameter, if specified; - - - -the time elapsed does not exceed the value specified -in the directive. - - - - - - -Example: - -upstream backend { - zone upstream_backend 10m; - server 127.0.0.1:12345; -} - -match http { - send "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n"; - expect ~ "200 OK"; -} - -server { - listen 12346; - proxy_pass backend; - health_check match=http; -} - - - - - -Only the first - -bytes of data obtained from the server are examined. - - - - - -This directive is available as part of our -commercial subscription. - - - - -
diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/ru/GNUmakefile --- a/xml/ru/GNUmakefile Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/ru/GNUmakefile Fri Mar 24 19:48:53 2017 +0300 @@ -102,6 +102,7 @@ stream/ngx_stream_ssl_module \ stream/ngx_stream_ssl_preread_module \ stream/ngx_stream_upstream_module \ + stream/ngx_stream_upstream_hc_module \ stream/stream_processing \ ngx_google_perftools_module \ diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/ru/docs/http/ngx_http_status_module.xml --- a/xml/ru/docs/http/ngx_http_status_module.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/ru/docs/http/ngx_http_status_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -9,7 +9,7 @@ + rev="16">
@@ -952,7 +952,7 @@ checks Суммарное число запросов -проверки +проверки работоспособности. @@ -971,7 +971,7 @@ Логическое значение, означающее, была ли последняя проверка работоспособности удачной и удовлетворял ли ответ заданным -тестам. +тестам. diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/ru/docs/index.xml --- a/xml/ru/docs/index.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/ru/docs/index.xml Fri Mar 24 19:48:53 2017 +0300 @@ -8,7 +8,7 @@
@@ -591,6 +591,11 @@ ngx_stream_upstream_module + + +ngx_stream_upstream_hc_module + + diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/ru/docs/stream/ngx_stream_upstream_hc_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/ru/docs/stream/ngx_stream_upstream_hc_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -0,0 +1,312 @@ + + + + + + + + +
+ + +Модуль ngx_stream_upstream_hc_module (1.9.0) +позволяет активировать периодические проверки работоспособности серверов в +группе. +Группа должна находиться в +зоне разделяемой памяти. + + + + +Модуль доступен как часть +коммерческой подписки. + + + +
+ + +
+ + + +upstream tcp { + zone upstream_tcp 64k; + + server backend1.example.com:12345 weight=5; + server backend2.example.com:12345 fail_timeout=5s slow_start=30s; + server 192.0.2.1:12345 max_fails=3; + + server backup1.example.com:12345 backup; + server backup2.example.com:12345 backup; +} + +server { + listen 12346; + proxy_pass tcp; + health_check; +} + + + +
+ + +
+ + +[параметры] + +server + + +Активирует периодические проверки работоспособности серверов в +группе. + + + +Могут быть заданы следующие необязательные параметры: + + + +interval=время + + +задаёт интервал между двумя последовательными проверками, +по умолчанию 5 секунд. + + + +jitter=время + + +задаёт время, в пределах которого +случайным образом задерживается каждая проверка, +по умолчанию задержки нет. + + + +fails=число + + +задаёт число последовательных неуспешных проверок для определённого сервера, +после которых сервер будет считаться неработоспособным, +по умолчанию 1. + + + +passes=число + + +задаёт число последовательных успешных проверок для определённого сервера, +после которых сервер будет считаться работоспособным, +по умолчанию 1. + + + +mandatory + + +устанавливает исходное состояние “checking” для сервера +до завершения первой проверки работоспособности (1.11.7). +Если параметр не указан, +то исходно сервер будет считаться работоспособным. + + + +match=имя + + +указывает на блок match с условиями, которым должно +удовлетворять соединение, чтобы результат проверки считался успешным. +По умолчанию для TCP проверяется +лишь возможность установки TCP-соединения с сервером, +для UDP проверяется отсутствие +сообщения ICMP “Destination Unreachable” +в ответ на отправленную строку “nginx health check”. + +До версии 1.11.7 по умолчанию для UDP +требовалось наличие блока match с параметрами +send и expect. + + + + +port=число + + +задаёт порт, используемый при подключении к серверу +для проверки его работоспособности (1.9.7). +По умолчанию совпадает с портом +сервера. + + + +udp + + +указывает, что для проверки работоспособности будет использоваться протокол +UDP +вместо протокола TCP, используемого по умолчанию (1.9.13). + + + + + + +В примере + +server { + proxy_pass backend; + health_check; +} + +для каждого сервера группы backend +с интервалом в 5 секунд проверяется возможность установки TCP-соединения. +Если соединение с сервером не может быть установлено, +проверка считается неуспешной и сервер +признаётся неработоспособным. +На неработоспособные серверы и серверы в состоянии “checking” +клиентские соединения передаваться не будут. + + + +Проверки работоспособности могут тестировать данные, полученные от сервера. +Тесты настраиваются отдельно при помощи директивы +и указываются в параметре match. + + + +Группа должна находиться в +зоне разделяемой памяти. + + + +Если для группы задано несколько проверок, +то при любой неуспешной проверке соответствующий сервер будет +считаться неработоспособным. + + + + + + +время +5s +stream +server + + +Переопределяет значение + +для проверок работоспособности. + + + + + + +имя + +stream + + +Задаёт именованный набор тестов для для анализа ответов сервера +на запросы проверки работоспособности. + + + +Могут быть заданы следующие параметры: + + + +send строка; + + +отправляет строку на сервер; + + + +expect стока | +~ regex; + + +текстовая строка (1.9.12) или регулярное выражение, +которым должны соответствовать данные, полученные с сервера. +Регулярное выражение задаётся либо с модификатором +“~*” (для поиска совпадения без учёта регистра символов), +либо с модификатором “~” (с учётом регистра). + + + +Параметры send и expect +могут содержать строки в шестнадцатеричном виде +с префиксом “\x” +и последующими двумя шестнадцатеричными цифрами, +например “\x80” (1.9.12). + + + +Проверка работоспособности считается успешной, если + + +TCP-соединение успешно установлено; + + + +строка из параметра send +была отправлена (если была задана); + + + +данные, полученные от сервера, совпали со строкой или регулярным выражением +из параметра expect (если был задан); + + + +истёкшее время не превышает значение, указанное +в директиве . + + + + + + +Пример: + +upstream backend { + zone upstream_backend 10m; + server 127.0.0.1:12345; +} + +match http { + send "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n"; + expect ~ "200 OK"; +} + +server { + listen 12346; + proxy_pass backend; + health_check match=http; +} + + + + + +Проверяются лишь первые байты данных +, +полученные от сервера. + + + + + +
+ +
diff -r 37df1535ea91 -r 6b6d0e844bf7 xml/ru/docs/stream/ngx_stream_upstream_module.xml --- a/xml/ru/docs/stream/ngx_stream_upstream_module.xml Thu Mar 30 21:26:44 2017 +0300 +++ b/xml/ru/docs/stream/ngx_stream_upstream_module.xml Fri Mar 24 19:48:53 2017 +0300 @@ -9,7 +9,7 @@ + rev="25">
@@ -46,7 +46,9 @@ -Динамически настраиваемая группа, +Динамически настраиваемая группа +с периодическими +проверками работоспособности доступна как часть коммерческой подписки: @@ -298,7 +300,7 @@ задаёт время, в течение которого вес сервера восстановится от нуля до своего номинального значения в ситуации, когда неработоспособный (unhealthy) сервер вновь становится работоспособным -(healthy) +(healthy) или когда сервер становится доступным по прошествии времени, в течение которого он считался недоступным. Значение по умолчанию равно нулю и означает, что медленный старт выключен. @@ -491,274 +493,6 @@ - - -[параметры] - -server - - -Активирует периодические проверки работоспособности серверов в -группе. - - - -Могут быть заданы следующие необязательные параметры: - - - -interval=время - - -задаёт интервал между двумя последовательными проверками, -по умолчанию 5 секунд. - - - -jitter=время - - -задаёт время, в пределах которого -случайным образом задерживается каждая проверка, -по умолчанию задержки нет. - - - -fails=число - - -задаёт число последовательных неуспешных проверок для определённого сервера, -после которых сервер будет считаться неработоспособным, -по умолчанию 1. - - - -passes=число - - -задаёт число последовательных успешных проверок для определённого сервера, -после которых сервер будет считаться работоспособным, -по умолчанию 1. - - - -mandatory - - -устанавливает исходное состояние “checking” для сервера -до завершения первой проверки работоспособности (1.11.7). -Если параметр не указан, -то исходно сервер будет считаться работоспособным. - - - -match=имя - - -указывает на блок match с условиями, которым должно -удовлетворять соединение, чтобы результат проверки считался успешным. -По умолчанию для TCP проверяется -лишь возможность установки TCP-соединения с сервером, -для UDP проверяется отсутствие -сообщения ICMP “Destination Unreachable” -в ответ на отправленную строку “nginx health check”. - -До версии 1.11.7 по умолчанию для UDP -требовалось наличие блока match с параметрами -send и expect. - - - - -port=число - - -задаёт порт, используемый при подключении к серверу -для проверки его работоспособности (1.9.7). -По умолчанию совпадает с портом сервера. - - - -udp - - -указывает, что для проверки работоспособности будет использоваться протокол -UDP -вместо протокола TCP, используемого по умолчанию (1.9.13). - - - - - - -В примере - -server { - proxy_pass backend; - health_check; -} - -для каждого сервера группы backend -с интервалом в 5 секунд проверяется возможность установки TCP-соединения. -Если соединение с сервером не может быть установлено, -проверка считается неуспешной и сервер -признаётся неработоспособным. -На неработоспособные серверы и серверы в состоянии “checking” -клиентские соединения передаваться не будут. - - - -Проверки работоспособности могут тестировать данные, полученные от сервера. -Тесты настраиваются отдельно при помощи директивы -и указываются в параметре match. - - - -Группа должна находиться в зоне разделяемой памяти. - - - -Если для группы задано несколько проверок, -то при любой неуспешной проверке соответствующий сервер будет -считаться неработоспособным. - - - - -Эта директива доступна как часть -коммерческой подписки. - - - - - - - -время -5s -stream -server - - -Переопределяет значение - -для проверок работоспособности. - - - - -Эта директива доступна как часть -коммерческой подписки. - - - - - - - -имя - -stream - - -Задаёт именованный набор тестов для для анализа ответов сервера -на запросы проверки работоспособности. - - - -Могут быть заданы следующие параметры: - - - -send строка; - - -отправляет строку на сервер; - - - -expect стока | -~ regex; - - -текстовая строка (1.9.12) или регулярное выражение, -которым должны соответствовать данные, полученные с сервера. -Регулярное выражение задаётся либо с модификатором -“~*” (для поиска совпадения без учёта регистра символов), -либо с модификатором “~” (с учётом регистра). - - - -Параметры send и expect -могут содержать строки в шестнадцатеричном виде -с префиксом “\x” -и последующими двумя шестнадцатеричными цифрами, -например “\x80” (1.9.12). - - - -Проверка работоспособности считается успешной, если - - -TCP-соединение успешно установлено; - - - -строка из параметра send -была отправлена (если была задана); - - - -данные, полученные от сервера, совпали со строкой или регулярным выражением -из параметра expect (если был задан); - - - -истёкшее время не превышает значение, указанное -в директиве . - - - - - - -Пример: - -upstream backend { - zone upstream_backend 10m; - server 127.0.0.1:12345; -} - -match http { - send "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n"; - expect ~ "200 OK"; -} - -server { - listen 12346; - proxy_pass backend; - health_check match=http; -} - - - - - -Проверяются лишь первые байты данных -, -полученные от сервера. - - - - - -Эта директива доступна как часть -коммерческой подписки. - - - - -