summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2018-06-15 11:46:14 +0300
committerVladimir Homutov <vl@nginx.com>2018-06-15 11:46:14 +0300
commit0c4ccbea23813a50132df511d4445bc1686dbc2f (patch)
tree953fbddab43d9e5d8a06e2d8f1e61d1e006a21dd /auto
parent2eab9efbe4050ab471cfa3ed778d751454fcd87d (diff)
downloadnginx-0c4ccbea23813a50132df511d4445bc1686dbc2f.tar.gz
nginx-0c4ccbea23813a50132df511d4445bc1686dbc2f.tar.bz2
Upstream: ngx_http_upstream_random module.
The module implements random load-balancing algorithm with optional second choice. In the latter case, the best of two servers is chosen, accounting number of connections and server weight. Example: upstream u { random [two [least_conn]]; server 127.0.0.1:8080; server 127.0.0.1:8081; server 127.0.0.1:8082; server 127.0.0.1:8083; }
Diffstat (limited to 'auto')
-rw-r--r--auto/modules21
-rw-r--r--auto/options10
2 files changed, 31 insertions, 0 deletions
diff --git a/auto/modules b/auto/modules
index 73a9bae9b..09bfcb08d 100644
--- a/auto/modules
+++ b/auto/modules
@@ -878,6 +878,17 @@ if [ $HTTP = YES ]; then
. auto/module
fi
+ if [ $HTTP_UPSTREAM_RANDOM = YES ]; then
+ ngx_module_name=ngx_http_upstream_random_module
+ ngx_module_incs=
+ ngx_module_deps=
+ ngx_module_srcs=src/http/modules/ngx_http_upstream_random_module.c
+ ngx_module_libs=
+ ngx_module_link=$HTTP_UPSTREAM_RANDOM
+
+ . auto/module
+ fi
+
if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then
ngx_module_name=ngx_http_upstream_keepalive_module
ngx_module_incs=
@@ -1143,6 +1154,16 @@ if [ $STREAM != NO ]; then
. auto/module
fi
+ if [ $STREAM_UPSTREAM_RANDOM = YES ]; then
+ ngx_module_name=ngx_stream_upstream_random_module
+ ngx_module_deps=
+ ngx_module_srcs=src/stream/ngx_stream_upstream_random_module.c
+ ngx_module_libs=
+ ngx_module_link=$STREAM_UPSTREAM_RANDOM
+
+ . auto/module
+ fi
+
if [ $STREAM_UPSTREAM_ZONE = YES ]; then
have=NGX_STREAM_UPSTREAM_ZONE . auto/have
diff --git a/auto/options b/auto/options
index 59f0449d8..d8b421b0f 100644
--- a/auto/options
+++ b/auto/options
@@ -102,6 +102,7 @@ HTTP_GZIP_STATIC=NO
HTTP_UPSTREAM_HASH=YES
HTTP_UPSTREAM_IP_HASH=YES
HTTP_UPSTREAM_LEAST_CONN=YES
+HTTP_UPSTREAM_RANDOM=YES
HTTP_UPSTREAM_KEEPALIVE=YES
HTTP_UPSTREAM_ZONE=YES
@@ -126,6 +127,7 @@ STREAM_SPLIT_CLIENTS=YES
STREAM_RETURN=YES
STREAM_UPSTREAM_HASH=YES
STREAM_UPSTREAM_LEAST_CONN=YES
+STREAM_UPSTREAM_RANDOM=YES
STREAM_UPSTREAM_ZONE=YES
STREAM_SSL_PREREAD=NO
@@ -273,6 +275,8 @@ $0: warning: the \"--with-ipv6\" option is deprecated"
--without-http_upstream_ip_hash_module) HTTP_UPSTREAM_IP_HASH=NO ;;
--without-http_upstream_least_conn_module)
HTTP_UPSTREAM_LEAST_CONN=NO ;;
+ --without-http_upstream_random_module)
+ HTTP_UPSTREAM_RANDOM=NO ;;
--without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;;
--without-http_upstream_zone_module) HTTP_UPSTREAM_ZONE=NO ;;
@@ -325,6 +329,8 @@ use the \"--with-mail_ssl_module\" option instead"
STREAM_UPSTREAM_HASH=NO ;;
--without-stream_upstream_least_conn_module)
STREAM_UPSTREAM_LEAST_CONN=NO ;;
+ --without-stream_upstream_random_module)
+ STREAM_UPSTREAM_RANDOM=NO ;;
--without-stream_upstream_zone_module)
STREAM_UPSTREAM_ZONE=NO ;;
@@ -485,6 +491,8 @@ cat << END
disable ngx_http_upstream_ip_hash_module
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module
+ --without-http_upstream_random_module
+ disable ngx_http_upstream_random_module
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module
--without-http_upstream_zone_module
@@ -535,6 +543,8 @@ cat << END
disable ngx_stream_upstream_hash_module
--without-stream_upstream_least_conn_module
disable ngx_stream_upstream_least_conn_module
+ --without-stream_upstream_random_module
+ disable ngx_stream_upstream_random_module
--without-stream_upstream_zone_module
disable ngx_stream_upstream_zone_module