# HG changeset patch # User Ruslan Ermilov # Date 1417430425 -10800 # Node ID f1e14d87d833dc369bcacd2a9e62cfcc2747e8d6 # Parent f3b7ec81b738faf8b4ffd4f5a1ae297e8ddb8fce Updated commercial docs for the upcoming release. diff --git a/GNUmakefile b/GNUmakefile --- a/GNUmakefile +++ b/GNUmakefile @@ -223,7 +223,7 @@ rsync_gzip: do_gzip: $(addsuffix .gz, $(wildcard $(ZIP)/*.html)) \ $(addsuffix .gz, \ $(foreach lang, $(LANGS), \ - $(foreach dir, . docs docs/faq docs/http docs/mail, \ + $(foreach dir, . docs docs/faq docs/http docs/mail docs/stream, \ $(wildcard $(ZIP)/$(lang)/$(dir)/*.html)))) \ $(ZIP)/index.rss.gz \ $(ZIP)/LICENSE.gz \ diff --git a/xml/en/GNUmakefile b/xml/en/GNUmakefile --- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -91,6 +91,8 @@ REFS = \ mail/ngx_mail_proxy_module \ mail/ngx_mail_smtp_module \ mail/ngx_mail_ssl_module \ + stream/ngx_stream_module \ + stream/ngx_stream_upstream_module \ TOP = \ download \ diff --git a/xml/en/docs/http/ngx_http_status_module.xml b/xml/en/docs/http/ngx_http_status_module.xml --- a/xml/en/docs/http/ngx_http_status_module.xml +++ b/xml/en/docs/http/ngx_http_status_module.xml @@ -154,10 +154,10 @@ Several virtual servers may share the sa The following status information is provided: -version +version Version of the provided data set. -The current version is 2. +The current version is 4. nginx_version @@ -170,7 +170,7 @@ Version of nginx. The address of the server that accepted status request. -load_timestamp +load_timestamp Time of the last reload of configuration, in milliseconds since Epoch. @@ -224,7 +224,7 @@ The current number of client requests. -server_zones +server_zones For each : @@ -278,7 +278,7 @@ The total number of bytes sent to client -upstreams +upstreams For each @@ -289,27 +289,36 @@ configurable the following data are provided: +id + +The ID of the server. + + server -An address of the -. +An +address +of the server. backup -A boolean value indicating whether the server is a backup server. +A boolean value indicating whether the server is a + +server. weight -Weight of the -. +Weight +of the server. -state +state Current state, which may be one of “up”, +“draining”, “down”, “unavail”, or @@ -327,6 +336,12 @@ The current number of idle connections. +max_conns + +The limit +for the server. + + requests The total number of @@ -378,8 +393,9 @@ unsuccessful attempts to communicate wit How many times the server became unavailable for client requests (state “unavail”) -due to the number of unsuccessful attempts reaching -the max_fails threshold. +due to the number of unsuccessful attempts reaching the + +threshold. health_checks @@ -429,10 +445,16 @@ when the server became or “unhealthy”. +selected + +The time (in milliseconds since Epoch) +when the server was last selected to process a request (1.7.5). + + -caches +caches For each cache (configured by and the likes): @@ -520,4 +542,46 @@ The total number of bytes written to the +
+ + + + + +The + field in + +was added in 4. + + + +The draining state in + +was added in 4. + + + +The + and fields in + +were added in 3. + + + +The revalidated field in + +was added in 3. + + + +The , , +and status data +were added in 2. + + + + + +
+ diff --git a/xml/en/docs/http/ngx_http_upstream_module.xml b/xml/en/docs/http/ngx_http_upstream_module.xml --- a/xml/en/docs/http/ngx_http_upstream_module.xml +++ b/xml/en/docs/http/ngx_http_upstream_module.xml @@ -320,7 +320,7 @@ This directive is available as part of o Specifies a load balancing method for a server group -where client-server mapping is based on the hashed key value. +where the client-server mapping is based on the hashed key value. The key can contain text, variables, and their combinations. Note that adding or removing a server from the group may result in remapping most of the keys to different servers. @@ -330,9 +330,9 @@ Perl library. -The consistent parameter specifies that +If the consistent parameter is specified the ketama -consistent hashing method should be used instead. +consistent hashing method will be used instead. The method ensures that only a few keys will be remapped to different servers when a server is added to or removed from the group. @@ -1166,6 +1166,13 @@ Same as the “down” parameter of the directive.
+drain= + +Puts the upstream server in the “draining” mode (1.7.5). +In this mode, only requests bound to the server +will be proxied to it. + + up= diff --git a/xml/en/docs/index.xml b/xml/en/docs/index.xml --- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -463,6 +463,22 @@ ngx_mail_smtp_module + + + + + +ngx_stream_module + + + + +ngx_stream_upstream_module + + + + + diff --git a/xml/en/docs/stream/ngx_stream_module.xml b/xml/en/docs/stream/ngx_stream_module.xml new file mode 100644 --- /dev/null +++ b/xml/en/docs/stream/ngx_stream_module.xml @@ -0,0 +1,293 @@ + + + + + + + + +
+ + +The stream module (1.7.7) provides +proxying TCP and UNIX-domain socket connections. + + + + +This module is available as part of our +commercial subscription. + + + +
+ +
+ + + +stream { + upstream backend { + least_conn; + server srv1.example.com:8000; + server srv2.example.com:8000; + server srv3.example.com:8001; + } + + server { + listen 9000; + proxy_connect_timeout 1s; + proxy_timeout 3s; + proxy_pass backend; + } +} + +In this example, a server that listens on port 9000 +proxies +TCP connections to a group of servers named backend. +Note that the +directive defined the context of the stream module +must not contain a protocol. +Two optional timeout parameters are specified: +the sets +a timeout required for establishing a connection with a server +that belongs to the backend group, while the + sets +a timeout used after proxying to one of the servers in the +backend group had started. +All TCP proxy-related functionality is configured inside the + block +just like the block +for HTTP requests. + + + +The backend group consists of three physical servers +(srv1-srv3). +Each server name follows the obligatory port number. +TCP connections are distributed among the servers according to the +least +connected load balancing method: a connection will go to the server +that has the fewest active connections. +Directives required to configure a group of proxied servers +and load-balancing can be found in the +ngx_stream_upstream_module. + + +
+ + +
+ + + + address:port + [bind] + [ipv6only=on|off] + [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]] + +server + + +Sets the address and port for the socket +on which the server will accept connections. +It is possible to specify just the port. +The address can also be a hostname, for example: + +listen 127.0.0.1:110; +listen *:110; +listen 110; # same as *:110 +listen localhost:110; + +IPv6 addresses are specified in square brackets: + +listen [::1]:110; +listen [::]:110; + +UNIX-domain sockets are specified with the “unix:” +prefix: + +listen unix:/var/run/nginx.sock; + + + + + +The directive supports the following parameters: + + + + +bind + + +this parameter instructs to make a separate bind +call for a given address:port pair. +The fact is that if there are several listen directives with +the same port but different addresses, and one of the +listen directives listens on all addresses +for the given port (*:port), nginx will +bind only to *:port. +It should be noted that the getsockname system call will be +made in this case to determine the address that accepted the connection. +If the ipv6only +or so_keepalive parameters +are used then for a given +address:port pair +a separate bind call will always be made. + + + +ipv6only=on|off + + +this parameter determines +(via the IPV6_V6ONLY socket option) +whether an IPv6 socket listening on a wildcard address [::] +will accept only IPv6 connections or both IPv6 and IPv4 connections. +This parameter is turned on by default. +It can only be set once on start. + + + +so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt] + + +this parameter configures the “TCP keepalive” behavior +for the listening socket. +If this parameter is omitted then the operating system’s settings will be +in effect for the socket. +If it is set to the value “on”, the +SO_KEEPALIVE option is turned on for the socket. +If it is set to the value “off”, the +SO_KEEPALIVE option is turned off for the socket. +Some operating systems support setting of TCP keepalive parameters on +a per-socket basis using the TCP_KEEPIDLE, +TCP_KEEPINTVL, and TCP_KEEPCNT socket options. +On such systems (currently, Linux 2.4+, NetBSD 5+, and +FreeBSD 9.0-STABLE), they can be configured +using the keepidle, keepintvl, and +keepcnt parameters. +One or two parameters may be omitted, in which case the system default setting +for the corresponding socket option will be in effect. +For example, +so_keepalive=30m::10 +will set the idle timeout (TCP_KEEPIDLE) to 30 minutes, +leave the probe interval (TCP_KEEPINTVL) at its system default, +and set the probes count (TCP_KEEPCNT) to 10 probes. + + + + + +Different servers must listen on different +address:port pairs. + + + + + + +time +60s +stream +server + + +Defines a timeout for establishing a connection with a proxied server. + + + + + + +size +16k +stream +server + + +Sets the size of the +buffers used for reading data from the client. + + + + + + +URL + +server + + +Sets the address of a proxied server or a +server group. +The address can be specified as a domain name or IP address, +and an obligatory port. +If a domain name resolves to several addresses, all of them will be +used in a round-robin fashion. + + + + + + +timeout +10m +stream +server + + +Defines a timeout used after the proxying to the backend had started. + + + + + + +size +16k +stream +server + + +Sets the size of the +buffers used for reading data from the upstream server. + + + + + + + + +stream + + +Sets the configuration for a server. + + + + + + + + +main + + +Provides the configuration file context in which the stream server directives +are specified. + + + + +
+ +
diff --git a/xml/en/docs/stream/ngx_stream_upstream_module.xml b/xml/en/docs/stream/ngx_stream_upstream_module.xml new file mode 100644 --- /dev/null +++ b/xml/en/docs/stream/ngx_stream_upstream_module.xml @@ -0,0 +1,261 @@ + + + + + + + + +
+ + +The ngx_stream_upstream_module module (1.7.7) +is used to define groups of servers that can be referenced +by the +directive. + + + + +This module is available as part of our +commercial subscription. + + + +
+ + +
+ + + +stream { + upstream backend { + hash $remote_addr consistent; + server backend1.example.com:8000; + server backend2.example.com:8000; + server backend3.example.com:8001; + } + + server { + listen 9000; + proxy_pass backend; + } +} + + + +
+ + +
+ + +name + +stream + + +Defines a group of servers. +Servers can listen on different ports. +In addition, servers listening on TCP and UNIX-domain sockets +can be mixed. + + + +Example: + +upstream backend { + server backend1.example.com:8080 weight=5; + server 127.0.0.1:8080 max_fails=3 fail_timeout=30s; + server unix:/tmp/backend3; + + server backup1.example.com:8080 backup; +} + + + + +By default, connections are distributed between the servers using a +weighted round-robin balancing method. +In the above example, each 7 connections will be distributed as follows: +5 connections go to backend1.example.com +and one connection to each of the second and third servers. +If an error occurs during communication with a server, the connection will +be passed to the next server, and so on until all of the functioning +servers will be tried. +If communication with all servers fails, the connection will be closed. + + + + + + +address [parameters] + +upstream + + +Defines the address and other parameters +of a server. +The address can be specified as a domain name or IP address +with an obligatory port, or as a UNIX-domain socket path +specified after the “unix:” prefix. +A domain name that resolves to several IP addresses defines +multiple servers at once. + + + +The following parameters can be defined: + + + +weight=number + + +sets the weight of the server, by default, 1. + + + +max_fails=number + + +sets the number of unsuccessful attempts to communicate with the server +that should happen in the duration set by the fail_timeout +parameter to consider the server unavailable for a duration also set by the +fail_timeout parameter. +By default, the number of unsuccessful attempts is set to 1. +The zero value disables the accounting of attempts. +Here, an unsuccessful attempt is an error or timeout +while establishing a connection with the server. + + + +fail_timeout=time + + +sets + + + +the time during which the specified number of unsuccessful attempts to +communicate with the server should happen to consider the server unavailable; + + + +and the period of time the server will be considered unavailable. + + + +By default, the parameter is set to 10 seconds. + + + +backup + + +marks the server as a backup server. +Connections to the backup server will be passed +when the primary servers are unavailable. + + + +down + + +marks the server as permanently unavailable; used along with +the directive. + + + +max_conns=number + + +limits the maximum number of simultaneous connections to the +proxied server. +Default value is zero, meaning there is no limit. + + + +slow_start=time + + +sets the time during which the server will recover its weight +from zero to a nominal value, +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. + + + + + + + +If there is only a single server in a group, max_fails, +fail_timeout and slow_start parameters +are ignored, and such a server will never be considered unavailable. + + + + + + + +key [consistent] + +upstream + + +Specifies a load balancing method for a server group +where client-server mapping is based on the hashed key value. +Currently, the only supported value for the key +is the client remote address specified as $remote_addr. +Note that adding or removing a server from the group +may result in remapping most of the keys to different servers. +The method is compatible with the +Cache::Memcached +Perl library. + + + +If the consistent parameter is specified, +the ketama +consistent hashing method will be used instead. +The method ensures that only a few keys +will be remapped to different servers +when a server is added to or removed from the group. +This helps to achieve a higher cache hit ratio for caching servers. +The method is compatible with the +Cache::Memcached::Fast +Perl library with the ketama_points parameter set to 160. + + + + + + + + +upstream + + +Specifies that a server group should use a load balancing method +where a connection +is passed to the server with the least number of active connections, +taking into account weights of servers. +If there are several such servers, they are tried in turn using a +weighted round-robin balancing method. + + + + +
+ +
diff --git a/xml/ru/docs/http/ngx_http_status_module.xml b/xml/ru/docs/http/ngx_http_status_module.xml --- a/xml/ru/docs/http/ngx_http_status_module.xml +++ b/xml/ru/docs/http/ngx_http_status_module.xml @@ -157,10 +157,10 @@ http://127.0.0.1/status/upstreams/backen Доступна следующая информация: -version +version Версия предоставляемого набора данных. -Текущей является версия 2. +Текущей является версия 4. nginx_version @@ -173,7 +173,7 @@ http://127.0.0.1/status/upstreams/backen Адрес сервера, принявшего запрос получения информации о состоянии.
-load_timestamp +load_timestamp Время последней перезагрузки конфигурации, в миллисекундах с начала эпохи. @@ -227,7 +227,7 @@ http://127.0.0.1/status/upstreams/backen -server_zones +server_zones Для каждой : @@ -281,7 +281,7 @@ http://127.0.0.1/status/upstreams/backen -upstreams +upstreams Для каждого сервера @@ -292,27 +292,34 @@ http://127.0.0.1/status/upstreams/backen доступны следующие данные: +id + +Идентификатор сервера. + + server -Адрес -сервера. +Адрес +сервера. backup -Логическое значение, означающее, является ли сервер запасным. +Логическое значение, означающее, является ли сервер +запасным. weight -Вес -сервера. +Вес +сервера. -state +state Текущее состояние, которое может быть одним из “up”, +“draining”, “down”, “unavail” или @@ -330,6 +337,12 @@ http://127.0.0.1/status/upstreams/backen -соединений. +max_conns + +Ограничение +для сервера. + + requests Суммарное число @@ -381,8 +394,8 @@ http://127.0.0.1/status/upstreams/backen Количество раз, когда сервер становился недоступным для клиентских запросов (состояние “unavail”) -из-за достижения порогового числа неудачных -попыток max_fails. +из-за достижения порогового числа неудачных попыток +. health_checks @@ -432,10 +445,16 @@ http://127.0.0.1/status/upstreams/backen или “unhealthy”. +selected + +Время (в миллисекундах с начала эпохи), +когда сервер в последний раз был выбран для обработки запроса (1.7.5). + + -caches +caches Для каждого кэша, сконфигурированного при помощи @@ -526,4 +545,43 @@ http://127.0.0.1/status/upstreams/backen +
+ + + + + +Поле в + +было добавлено в версии 4. + + + +Состояние draining в + +было добавлено в версии 4. + + + +Поля и в + +были добавлены в версии 3. + + + +Поле revalidated в +было добавлено в версии 3. + + + +, +были добавлены в версии 2. + + + + + +
+ diff --git a/xml/ru/docs/http/ngx_http_upstream_module.xml b/xml/ru/docs/http/ngx_http_upstream_module.xml --- a/xml/ru/docs/http/ngx_http_upstream_module.xml +++ b/xml/ru/docs/http/ngx_http_upstream_module.xml @@ -1173,6 +1173,14 @@ http://127.0.0.1/upstream_conf?upstream= директивы .
+drain= + + +Переводит сервер группы в режим “draining” (1.7.5). +В этом режиме на сервер будут проксироваться только +привязанные к нему запросы. + + up=