comparison xml/en/docs/http/ngx_http_upstream_conf_module.xml @ 1450:f5b5eefc43cb

Updated commercial docs for the upcoming release.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 09 Apr 2015 19:18:54 +0300
parents xml/en/docs/http/ngx_http_upstream_module.xml@410e0683b6b4
children d3c1a4e8c1fe
comparison
equal deleted inserted replaced
1449:c79501e16e26 1450:f5b5eefc43cb
1 <?xml version="1.0"?>
2
3 <!--
4 Copyright (C) Nginx, Inc.
5 -->
6
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
8
9 <module name="Module ngx_http_upstream_conf_module"
10 link="/en/docs/http/ngx_http_upstream_conf_module.html"
11 lang="en"
12 rev="1">
13
14 <section id="summary">
15
16 <para>
17 The <literal>ngx_http_upstream_conf_module</literal> module
18 allows configuring upstream server groups on-the-fly
19 via a simple HTTP interface without the need of restarting nginx.
20 The
21 <link doc="ngx_http_upstream_module.xml" id="zone">http</link>
22 or
23 <link doc="../stream/ngx_stream_upstream_module.xml" id="zone">stream</link>
24 server group must reside in the shared memory.
25 </para>
26
27 </section>
28
29
30 <section id="example" name="Example Configuration">
31
32 <para>
33 <example>
34 upstream backend {
35 zone upstream_backend 64k;
36
37 ...
38 }
39
40 server {
41 location /upstream_conf {
42 <emphasis>upstream_conf</emphasis>;
43 allow 127.0.0.1;
44 deny all;
45 }
46 }
47 </example>
48 </para>
49
50 </section>
51
52
53 <section id="directives" name="Directives">
54
55 <directive name="upstream_conf">
56 <syntax/>
57 <default/>
58 <context>location</context>
59
60 <para>
61 Turns on the HTTP interface of upstream configuration in the surrounding
62 location.
63 Access to this location should be
64 <link doc="ngx_http_core_module.xml" id="satisfy">limited</link>.
65 </para>
66
67 <para>
68 Configuration commands can be used to:
69 <list type="bullet">
70
71 <listitem>view the group configuration;</listitem>
72
73 <listitem>view, modify, or remove a server;</listitem>
74
75 <listitem>add a new server.</listitem>
76
77 </list>
78 <note>
79 Since addresses in a group are not required to be unique, specific
80 servers in a group are referenced by their IDs.
81 IDs are assigned automatically and shown when adding a new server
82 or viewing the group configuration.
83 </note>
84 </para>
85
86 <para>
87 A configuration command consists of parameters passed as request arguments,
88 for example:
89 <example>
90 http://127.0.0.1/upstream_conf?upstream=backend
91 </example>
92 </para>
93
94 <para>
95 The following parameters are supported:
96
97 <list type="tag" compact="no">
98
99 <tag-name>
100 <literal>stream=</literal></tag-name>
101 <tag-desc>
102 Selects a
103 <link doc="../stream/ngx_stream_upstream_module.xml">stream</link>
104 upstream server group.
105 Without this parameter, selects an
106 <link doc="ngx_http_upstream_module.xml">http</link>
107 upstream server group.
108 </tag-desc>
109
110 <tag-name>
111 <literal>upstream=</literal><value>name</value></tag-name>
112 <tag-desc>
113 Selects a group to work with.
114 This parameter is mandatory.
115 </tag-desc>
116
117 <tag-name>
118 <literal>id=</literal><value>number</value></tag-name>
119 <tag-desc>
120 Selects a server for viewing, modifying, or removing.
121 </tag-desc>
122
123 <tag-name>
124 <literal>remove=</literal></tag-name>
125 <tag-desc>
126 Removes a server from the group.
127 </tag-desc>
128
129 <tag-name>
130 <literal>add=</literal></tag-name>
131 <tag-desc>
132 Adds a new server to the group.
133 </tag-desc>
134
135 <tag-name>
136 <literal>backup=</literal></tag-name>
137 <tag-desc>
138 Required to add a backup server.
139 <note>
140 Before version 1.7.2, <literal>backup=</literal>
141 was also required to view, modify, or remove existing backup servers.
142 </note>
143 </tag-desc>
144
145 <tag-name>
146 <literal>server=</literal><value>address</value></tag-name>
147 <tag-desc>
148 Same as the “<literal>address</literal>” parameter
149 of the
150 <link doc="ngx_http_upstream_module.xml" id="server">http</link>
151 or
152 <link doc="../stream/ngx_stream_upstream_module.xml" id="server">stream</link>
153 upstream server.
154 <para>
155 When adding a server, it is possible to specify it as a domain name.
156 In this case, changes of the IP addresses that correspond to a domain name
157 will be monitored and automatically applied to the upstream
158 configuration without the need of restarting nginx (1.7.2).
159 This requires the “<literal>resolver</literal>” directive in the
160 <link doc="ngx_http_core_module.xml" id="resolver">http</link>
161 or
162 <link doc="../stream/ngx_stream_core_module.xml" id="resolver">stream</link>
163 block.
164 See also the “<literal>resolve</literal>” parameter
165 of the
166 <link doc="ngx_http_upstream_module.xml" id="resolve">http</link>
167 or
168 <link doc="../stream/ngx_stream_upstream_module.xml" id="resolve">stream</link>
169 upstream server.
170 </para>
171 </tag-desc>
172
173 <tag-name>
174 <literal>weight=</literal><value>number</value></tag-name>
175 <tag-desc>
176 Same as the “<literal>weight</literal>” parameter
177 of the
178 <link doc="ngx_http_upstream_module.xml" id="weight">http</link>
179 or
180 <link doc="../stream/ngx_stream_upstream_module.xml" id="weight">stream</link>
181 upstream server.
182 </tag-desc>
183
184 <tag-name>
185 <literal>max_conns=</literal><value>number</value></tag-name>
186 <tag-desc>
187 Same as the “<literal>max_conns</literal>” parameter
188 of the
189 <link doc="ngx_http_upstream_module.xml" id="max_conns">http</link>
190 or
191 <link doc="../stream/ngx_stream_upstream_module.xml" id="max_conns">stream</link>
192 upstream server.
193 </tag-desc>
194
195 <tag-name>
196 <literal>max_fails=</literal><value>number</value></tag-name>
197 <tag-desc>
198 Same as the “<literal>max_fails</literal>” parameter
199 of the
200 <link doc="ngx_http_upstream_module.xml" id="max_fails">http</link>
201 or
202 <link doc="../stream/ngx_stream_upstream_module.xml" id="max_fails">stream</link>
203 upstream server.
204 </tag-desc>
205
206 <tag-name>
207 <literal>fail_timeout=</literal><value>time</value></tag-name>
208 <tag-desc>
209 Same as the “<literal>fail_timeout</literal>” parameter
210 of the
211 <link doc="ngx_http_upstream_module.xml" id="fail_timeout">http</link>
212 or
213 <link doc="../stream/ngx_stream_upstream_module.xml" id="fail_timeout">stream</link>
214 upstream server.
215 </tag-desc>
216
217 <tag-name>
218 <literal>slow_start=</literal><value>time</value></tag-name>
219 <tag-desc>
220 Same as the “<literal>slow_start</literal>” parameter
221 of the
222 <link doc="ngx_http_upstream_module.xml" id="slow_start">http</link>
223 or
224 <link doc="../stream/ngx_stream_upstream_module.xml" id="slow_start">stream</link>
225 upstream server.
226 </tag-desc>
227
228 <tag-name>
229 <literal>down=</literal></tag-name>
230 <tag-desc>
231 Same as the “<literal>down</literal>” parameter
232 of the
233 <link doc="ngx_http_upstream_module.xml" id="down">http</link>
234 or
235 <link doc="../stream/ngx_stream_upstream_module.xml" id="down">stream</link>
236 upstream server.
237 </tag-desc>
238
239 <tag-name id="drain"><literal>drain=</literal></tag-name>
240 <tag-desc>
241 Puts the
242 <link doc="ngx_http_upstream_module.xml">http</link>
243 upstream server in the “draining” mode (1.7.5).
244 In this mode, only requests of the
245 <link doc="ngx_http_upstream_module.xml" id="sticky">bound</link> to the server
246 will be proxied to it.
247 </tag-desc>
248
249 <tag-name>
250 <literal>up=</literal></tag-name>
251 <tag-desc>
252 The opposite of the “<literal>down</literal>” parameter
253 of the
254 <link doc="ngx_http_upstream_module.xml" id="down">http</link>
255 or
256 <link doc="../stream/ngx_stream_upstream_module.xml" id="down">stream</link>
257 upstream server.
258 </tag-desc>
259
260 <tag-name>
261 <literal>route=</literal><value>string</value></tag-name>
262 <tag-desc>
263 Same as the “<literal>route</literal>” parameter of the
264 <link doc="ngx_http_upstream_module.xml" id="route">http</link>
265 upstream server.
266 </tag-desc>
267
268 </list>
269
270 The first three parameters select an object.
271 This can be either the whole http or stream upstream server group,
272 or a specific server.
273 Without other parameters, the configuration of the selected
274 group or server is shown.
275 </para>
276
277 <para>
278 For example, to view the configuration of the whole group, send:
279 <example>
280 http://127.0.0.1/upstream_conf?upstream=backend
281 </example>
282
283 To view the configuration of a specific server, also specify its ID:
284 <example>
285 http://127.0.0.1/upstream_conf?upstream=backend&amp;id=42
286 </example>
287 </para>
288
289 <para>
290 To add a new server,
291 specify its address in the “<literal>server=</literal>” parameter.
292 Without other parameters specified, a server will be added with other
293 parameters set to their default values (see the
294 <link doc="ngx_http_upstream_module.xml" id="server">http</link>
295 or
296 <link doc="../stream/ngx_stream_upstream_module.xml" id="server">stream</link>
297 “<literal>server</literal>” directive).
298 </para>
299
300 <para>
301 For example, to add a new primary server, send:
302 <example>
303 http://127.0.0.1/upstream_conf?add=&amp;upstream=backend&amp;server=127.0.0.1:8080
304 </example>
305
306 To add a new backup server, send:
307 <example>
308 http://127.0.0.1/upstream_conf?add=&amp;upstream=backend&amp;backup=&amp;server=127.0.0.1:8080
309 </example>
310
311 To add a new primary server,
312 set its parameters to non-default values
313 and mark it as “<literal>down</literal>”, send:
314 <example>
315 http://127.0.0.1/upstream_conf?add=&amp;upstream=backend&amp;server=127.0.0.1:8080&amp;weight=2&amp;down=
316 </example>
317
318 To remove a server, specify its ID:
319 <example>
320 http://127.0.0.1/upstream_conf?remove=&amp;upstream=backend&amp;id=42
321 </example>
322
323 To mark an existing server as “<literal>down</literal>”, send:
324 <example>
325 http://127.0.0.1/upstream_conf?upstream=backend&amp;id=42&amp;down=
326 </example>
327
328 To modify the address of an existing server, send:
329 <example>
330 http://127.0.0.1/upstream_conf?upstream=backend&amp;id=42&amp;server=192.0.2.3:8123
331 </example>
332
333 To modify other parameters of an existing server, send:
334 <example>
335 http://127.0.0.1/upstream_conf?upstream=backend&amp;id=42&amp;max_fails=3&amp;weight=4
336 </example>
337
338 The above examples are for an
339 <link doc="ngx_http_upstream_module.xml">http</link>
340 upstream server group.
341 Similar examples for a
342 <link doc="../stream/ngx_stream_upstream_module.xml">stream</link>
343 upstream server group require the “<literal>stream=</literal>” parameter.
344 </para>
345
346 </directive>
347
348 </section>
349
350 </module>