comparison xml/en/docs/stream/ngx_stream_upstream_module.xml @ 1406:ea73cd9d4cdb

Changed stream_upstream examples.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 05 Feb 2015 15:25:48 +0300
parents 4569719f4247
children f5dcc23b214f
comparison
equal deleted inserted replaced
1405:4569719f4247 1406:ea73cd9d4cdb
1 <?xml version="1.0"?> 1 <?xml version="1.0"?>
2 2
3 <!-- 3 <!--
4 Copyright (C) 2014 Yaroslav Zhuravlev
5 Copyright (C) Nginx, Inc. 4 Copyright (C) Nginx, Inc.
6 --> 5 -->
7 6
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> 7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
9 8
10 <module name="Module ngx_stream_upstream_module" 9 <module name="Module ngx_stream_upstream_module"
11 link="/en/docs/stream/ngx_stream_upstream_module.html" 10 link="/en/docs/stream/ngx_stream_upstream_module.html"
12 lang="en" 11 lang="en"
13 rev="2"> 12 rev="3">
14 13
15 <section id="summary"> 14 <section id="summary">
16 15
17 <para> 16 <para>
18 The <literal>ngx_stream_upstream_module</literal> module (1.7.7) 17 The <literal>ngx_stream_upstream_module</literal> module (1.7.7)
33 32
34 <section id="example" name="Example Configuration"> 33 <section id="example" name="Example Configuration">
35 34
36 <para> 35 <para>
37 <example> 36 <example>
38 stream { 37 upstream <emphasis>backend</emphasis> {
39 upstream backend { 38 hash $remote_addr consistent;
40 hash $remote_addr consistent; 39
41 server backend1.example.com:8000; 40 server backend1.example.com:12345 weight=5;
42 server backend2.example.com:8000; 41 server 127.0.0.1:12345 max_fails=3 fail_timeout=30s;
43 server backend3.example.com:8001; 42 server unix:/tmp/backend3;
44 } 43 }
45 44
46 server { 45 server {
47 listen 9000; 46 listen 12346;
48 proxy_pass backend; 47 proxy_pass <emphasis>backend</emphasis>;
49 }
50 } 48 }
51 </example> 49 </example>
52 </para> 50 </para>
53 51
54 </section> 52 </section>
70 68
71 <para> 69 <para>
72 Example: 70 Example:
73 <example> 71 <example>
74 upstream backend { 72 upstream backend {
75 server backend1.example.com:8080 weight=5; 73 server backend1.example.com:12345 weight=5;
76 server 127.0.0.1:8080 max_fails=3 fail_timeout=30s; 74 server 127.0.0.1:12345 max_fails=3 fail_timeout=30s;
77 server unix:/tmp/backend3; 75 server unix:/tmp/backend3;
78 76
79 server backup1.example.com:8080 backup; 77 server backup1.example.com:12345 backup;
80 } 78 }
81 </example> 79 </example>
82 </para> 80 </para>
83 81
84 <para> 82 <para>
85 By default, connections are distributed between the servers using a 83 By default, connections are distributed between the servers using a
86 weighted round-robin balancing method. 84 weighted round-robin balancing method.
87 In the above example, each 7 connections will be distributed as follows: 85 In the above example, each 7 connections will be distributed as follows:
88 5 connections go to <literal>backend1.example.com</literal> 86 5 connections go to <literal>backend1.example.com:12345</literal>
89 and one connection to each of the second and third servers. 87 and one connection to each of the second and third servers.
90 If an error occurs during communication with a server, the connection will 88 If an error occurs during communication with a server, the connection will
91 be passed to the next server, and so on until all of the functioning 89 be passed to the next server, and so on until all of the functioning
92 servers will be tried. 90 servers will be tried.
93 If communication with all servers fails, the connection will be closed. 91 If communication with all servers fails, the connection will be closed.