<div dir="ltr"><div><div><div><div><div><div>First of all thanks for your reply. But what happens if I have for example a hostname: test, which resolves to a randomized list of multiple ip's. Such that when I do:<br><br></div>dig test<br>10.0.0.8<br>10.0.0.9<br>10.0.0.10<br><br></div>and a few moments later<br></div><br>dig test<br>10.0.0.10<br>10.0.0.8<br>10.0.0.9<br><br></div>Is it then still consistent on the ip's or is the consistency just on the name "test" in this case?</div><div><br></div><div>From the docs I read that it resolves the hostname and injects the ip's as server when multiple ip's are returned. But it's not completely clear on which the hash is acting.<br></div><div><br></div>I am asking this, because docker constantly returns a randomized fixed list of ip's (for dns load balancing). But I always want to route a user, targetting for some url, to the same container.<br></div><div><br><br><div><div><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-09 11:25 GMT+02:00 Roman Arutyunyan <span dir="ltr"><<a href="mailto:arut@nginx.com" target="_blank">arut@nginx.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ruben,<br>
<div><div class="h5"><br>
On Mon, Oct 09, 2017 at 09:33:55AM +0200, Ruben wrote:<br>
> I was wondering what the selection algorithm is for choosing a server in<br>
> the upstream directive using hash. Is the selection based on the ip of the<br>
> server or is it based on the position of the list.<br>
><br>
> So if I have for example the following configuration:<br>
><br>
> upstream test {<br>
> hash $arg_test;<br>
> server 10.0.0.10;<br>
> server 10.0.0.9;<br>
> server 10.0.0.8;<br>
> }<br>
><br>
> or (ip's in different order)<br>
><br>
> upstream chat {<br>
> hash $arg_test;<br>
> server 10.0.0.8;<br>
> server 10.0.0.9;<br>
> server 10.0.0.10;<br>
> }<br>
><br>
> If someone is targeting an url with ?test=1, is it in both configs directed<br>
> to the same ip or not. So is the selection based on the ip or based omn the<br>
> position in the list.<br>
<br>
</div></div>The regular (non-consistent) hash balancer selects a server based on the<br>
position in the list. However, the consistent hash balancer<br>
(hash $arg_test consistent) makes a selection based on the server name/ip<br>
specified in the "server" directive.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Roman Arutyunyan<br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br></div>