changeset 2191:2c56f91c304a

Documented the "random" directive.
author Vladimir Homutov <vl@nginx.com>
date Fri, 08 Jun 2018 13:58:05 +0300
parents dfc49994218c
children e1337bf9f63b
files xml/en/docs/http/ngx_http_upstream_module.xml xml/en/docs/stream/ngx_stream_upstream_module.xml xml/ru/docs/http/ngx_http_upstream_module.xml xml/ru/docs/stream/ngx_stream_upstream_module.xml
diffstat 4 files changed, 108 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_upstream_module.xml
+++ b/xml/en/docs/http/ngx_http_upstream_module.xml
@@ -10,7 +10,7 @@
 <module name="Module ngx_http_upstream_module"
         link="/en/docs/http/ngx_http_upstream_module.html"
         lang="en"
-        rev="70">
+        rev="71">
 
 <section id="summary">
 
@@ -804,6 +804,32 @@ This directive is available as part of o
 </directive>
 
 
+<directive name="random">
+<syntax>[<literal>two</literal> [<value>method</value>]]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.15.1</appeared-in>
+
+<para>
+Specifies that a group should use a load balancing method where a request
+is passed to a randomly selected server, taking into account weights
+of servers.
+</para>
+
+<para>
+The optional <literal>two</literal> parameter
+instructs nginx to randomly select
+<link url="http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf">two</link>
+servers and then choose a server
+using the specified <literal>method</literal>.
+The default method is <literal>least_conn</literal>
+which passes a request to a server
+with the least number of active connections.
+</para>
+
+</directive>
+
+
 <directive name="sticky">
 <syntax>
     <literal>cookie</literal> <value>name</value>
--- a/xml/en/docs/stream/ngx_stream_upstream_module.xml
+++ b/xml/en/docs/stream/ngx_stream_upstream_module.xml
@@ -9,7 +9,7 @@
 <module name="Module ngx_stream_upstream_module"
         link="/en/docs/stream/ngx_stream_upstream_module.html"
         lang="en"
-        rev="27">
+        rev="28">
 
 <section id="summary">
 
@@ -497,6 +497,32 @@ This directive is available as part of o
 
 </directive>
 
+
+<directive name="random">
+<syntax>[<literal>two</literal> [<value>method</value>]]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.15.1</appeared-in>
+
+<para>
+Specifies that a group should use a load balancing method where a connection
+is passed to a randomly selected server, taking into account weights
+of servers.
+</para>
+
+<para>
+The optional <literal>two</literal> parameter
+instructs nginx to randomly select
+<link url="http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf">two</link>
+servers and then choose a server
+using the specified <literal>method</literal>.
+The default method is <literal>least_conn</literal>
+which passes a connection to a server
+with the least number of active connections.
+</para>
+
+</directive>
+
 </section>
 
 
--- a/xml/ru/docs/http/ngx_http_upstream_module.xml
+++ b/xml/ru/docs/http/ngx_http_upstream_module.xml
@@ -10,7 +10,7 @@
 <module name="Модуль ngx_http_upstream_module"
         link="/ru/docs/http/ngx_http_upstream_module.html"
         lang="ru"
-        rev="70">
+        rev="71">
 
 <section id="summary">
 
@@ -811,6 +811,32 @@ server {
 </directive>
 
 
+<directive name="random">
+<syntax>[<literal>two</literal> [<value>метод</value>]]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.15.1</appeared-in>
+
+<para>
+Задаёт для группы метод балансировки нагрузки, при котором запрос
+передаётся случайно выбранному серверу, с учётом весов
+серверов.
+</para>
+
+<para>
+Если указан необязательный параметр <literal>two</literal>,
+то nginx случайным образом выбирает
+<link url="http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf">два</link>
+сервера, из которых выбирает сервер,
+используя указанный <literal>метод</literal>.
+Методом по умолчанию является <literal>least_conn</literal>,
+при котором запрос передаётся на сервер
+с наименьшим количеством активных соединений.
+</para>
+
+</directive>
+
+
 <directive name="sticky">
 <syntax>
     <literal>cookie</literal> <value>имя</value>
--- a/xml/ru/docs/stream/ngx_stream_upstream_module.xml
+++ b/xml/ru/docs/stream/ngx_stream_upstream_module.xml
@@ -9,7 +9,7 @@
 <module name="Модуль ngx_stream_upstream_module"
         link="/ru/docs/stream/ngx_stream_upstream_module.html"
         lang="ru"
-        rev="27">
+        rev="28">
 
 <section id="summary">
 
@@ -498,6 +498,32 @@ hash $remote_addr;
 
 </directive>
 
+
+<directive name="random">
+<syntax>[<literal>two</literal> [<value>метод</value>]]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.15.1</appeared-in>
+
+<para>
+Задаёт для группы метод балансировки нагрузки, при котором соединение
+передаётся случайно выбранному серверу, с учётом весов
+серверов.
+</para>
+
+<para>
+Если указан необязательный параметр <literal>two</literal>,
+то nginx случайным образом выбирает
+<link url="http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf">два</link>
+сервера, из которых выбирает сервер,
+используя указанный <literal>метод</literal>.
+Методом по умолчанию является <literal>least_conn</literal>,
+при котором соединение передаётся на сервер
+с наименьшим количеством активных соединений.
+</para>
+
+</directive>
+
 </section>