You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move the explanation of set definition to later in the document, replacing its old location with a cross-reference. The new section goes into much more clarity about how sets just give you an alternate way of passing lists of pools to route handlers, with more fleshed-out examples.
Copy file name to clipboardExpand all lines: content/features/proxy/configure.md
+66-43Lines changed: 66 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,49 +120,7 @@ pools {
120
120
}
121
121
```
122
122
123
-
#### Define sets of pools {#sets}
124
-
125
-
You can optionally gather pools into named _sets_, each of which contains a list of pool definitions. You might want to employ this technique if you have several pools of backends that you want the router to treat as mutually equivalent with synchronized data:
126
-
127
-
```lua
128
-
{{<var>}}SET_NAME{{</var>}} = {
129
-
{
130
-
{ backends= {{<var>}}[ ... ]{{</var>}} },
131
-
{ backends= {{<var>}}[ ... ]{{</var>}} },
132
-
{{<var>}}[ ... ]{{</var>}}
133
-
},
134
-
{{<var>}}[ ... ]{{</var>}}
135
-
}
136
-
```
137
-
138
-
Replace <var>SET_NAME</var> with a name for this set of pools—for example, `set_customer_pools`. The name must begin with `set_`.
139
-
140
-
{{< callout type="warning" >}}If you don't start a set's name with `set_`, then Memcached reads it as an ordinary pool definition, likely resulting in a syntax error.{{</callout>}}
141
-
142
-
The following example defines one set named `set_main_pool` which contains the two pools from the previous `pools{}` example:
Sets are also useful when organizing pools into named zones as part of an ordered failover strategy. For more information, see [Prioritize a route using local zones](#zones).
123
+
You can optionally define named sets of pools within the `pools{}` block, as well as individual, named pools. For more information, see [Gather related pools into sets](#sets).
166
124
167
125
### Define proxy routes
168
126
@@ -378,6 +336,71 @@ If you have defined the backend using the alternate list-based syntax, then add
378
336
379
337
To mark the backend as online again, remove the `_down_` or `down=true` attribute from the backend's definition in the proxy configuration file.
380
338
339
+
## Gather related pools into sets {#sets}
340
+
341
+
Any route handler that requires a list of pools among its arguments lets you alternately specify a _set_ of pools, instead. You define sets in the `pools{}` section of your configuration file using the following syntax:
342
+
343
+
```lua
344
+
{{<var>}}SET_NAME{{</var>}} = {
345
+
{
346
+
{ {{<var>}}POOL_DEFINITION{{</var>}} },
347
+
{{<var>}}[ ... ]{{</var>}}
348
+
},
349
+
}
350
+
```
351
+
352
+
Replace the following:
353
+
354
+
* <var>SET_NAME</var>: the name for this set of pools—for example, `set_customer_pools`. The name must begin with `set_`.
355
+
356
+
{{< callout type="warning" >}}If you don't start a set's name with `set_`, then Memcached reads it as an ordinary pool definition, likely resulting in a syntax error.{{</callout>}}
357
+
358
+
* <var>POOL_DEFINITION</var>: a complete, "anonymous" [pool definition](#pools)—that is, it has no pool name attached.
359
+
360
+
In the simplest case, the definition is `backends = { {{<var>}}[ ... ]{{</var>}} }`, defining a list of the pool's backends.
361
+
362
+
The following example defines one set named `set_main_pools`, which contains three backends. The example then uses that set to create a [failover route]({{<proxy_base_path>}}reference#route_failover):
When passing arguments to route handlers, the following actions are functionally equivalent:
393
+
394
+
* Passing a list of pool names to a route handler—for example:
395
+
396
+
`route_allsync{ children = { "main_pool_1", "main_pool_2" } }`
397
+
398
+
* Passing a single set name to a route handler—for example:
399
+
400
+
`route_allsync{ children = "set_main_pools" }`
401
+
402
+
Choose the technique that makes the most sense for your use case, in terms of the legibility and maintainability of your configuration file.
403
+
381
404
## Prioritize a route using local zones {#zones}
382
405
383
406
If you have [organized your pools into named sets](#sets), then you can further configure the proxy to prefer routing requests to certain pools within a set, even if other pools are available. You might want to do this to prefer routing requests to a pool that is geographically closer to the proxy, for example.
0 commit comments