<div dir="ltr">
Hi,
<br>
<br>i am using latest (1.15.4) nginx with stream module.
<br>
<br>I am trying to create config with one primary server that will accept no
more than 10 connections and multiple backups that will also receive up
to 10 connections only when previous backup server is already full.
<br>
<br>As exact behavior of multiple backup directives is not well explained in
documentation i would like to ask if i am doing right.
<br>
<br>
<br>My current configuration is:
<br>stream {
<br> upstream backend {
<br> zone upstream_backend 64k;
<br> server <a href="http://10.0.1.1:9306">10.0.1.1:9306</a> max_conns=10;
<br> server <a href="http://10.0.1.2:9306">10.0.1.2:9306</a> max_conns=10 backup;
<br> server <a href="http://10.0.1.3:9306">10.0.1.3:9306</a> max_conns=10 backup;
<br> server <a href="http://10.0.1.4:9306">10.0.1.4:9306</a> backup;
<br> }
<br> server {
<br> listen <a href="http://127.0.0.1:9306">127.0.0.1:9306</a>;
<br> proxy_connect_timeout 1s;
<br> proxy_timeout 3s;
<br> proxy_pass backend;
<br> }
<br>}
<br>
<br>
<br>I would like it to work like this:
<br>
<br>When we have up to 10 concurrent connections, all should go always to
primary 10.0.1.1
<br>
<br>When we have 25 concurrent connections it should work like this:
<br>-First 10 connections go to primary 10.0.1.1
<br>-Next 10 connections go to backup 10.0.1.2
<br>-Next 5 connections go to backup 10.0.1.3
<br>
<br>When we have 45 concurrent connections it should work like this:
<br>-First 10 connections go to primary 10.0.1.1
<br>-Next 10 connections go to backup 10.0.1.2
<br>-Next 10 connections go to backup 10.0.1.3
<br>-Next 15 connections go to backup 10.0.1.4
<br>
<br>
<br>Will multiple backup directives work as i expected or will they just
round robin between each of them up to max_conns limit ?
<br>
<br>
<br>Regards,
<br>Marcin Wanat
</div>