<div dir="ltr">> <span style="font-size:12.8000001907349px">Just use names in the configuration.</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">You mean local DNS?</span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><br></div>Best regards,<br>Dmitriy Shalashov<br></div></div></div>
<br><div class="gmail_quote">2015-02-12 17:53 GMT+03:00 Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<span class=""><br>
On Thu, Feb 12, 2015 at 05:19:46PM +0300, Дмитрий Шалашов wrote:<br>
<br>
> Ok, thanks.<br>
><br>
> Can you imagine any other viable way to pass some information to each<br>
> server? It doesn't need to change between server restarts.<br>
> I may use a distinct variable for each of them but this seems ugly and<br>
> error-prone...<br>
<br>
</span>You may want to rethink what you are trying to do.  In this<br>
particular case the whole task seems to be unneeded, see below.<br>
<span class=""><br>
> In case you are curious why would I need this, let me explain.<br>
> Upstream directive support "hash consistent" method and in that case it<br>
> uses `ketama` algorithm. That means that each server assigned a key and<br>
> depending on its value (actually hash of that value) each server mapped to<br>
> a multiple points on the ketama ring. So far so good.<br>
> Documentation says that keys distribution is compatible with Perl<br>
> Cache::Memcached::Fast module. And that means that key for each server is<br>
> "$ip\0$port" (or something else for unix sockets, doesn't matter).<br>
> This means that if server ip changes, position of server points on ketama<br>
> ring will change too. Now, I'm balancing via this upstream not memcacheds<br>
> or other rather ephemeral storages but files. Each server in the upstream<br>
> have a hundreds of gigabytes of files. And I would like to avoid<br>
> rebalancing all these files in case of public ip changes.<br>
> So my idea was to pass a key for each server via parameter. Actually, to<br>
> preserve compatibility with current keys, I would pass a base64 of<br>
> "$ip\0$port" value, decode it during module init and happily use it for<br>
> ketama purposes. And be safe against servers redeployments.<br>
<br>
</span>Just use names in the configuration.  Both Cache::Memcached::Fast<br>
and nginx will happily use names of servers and will derive<br>
Ketama points from names, not IP-addresses.  That is, key<br>
distribution will stay the same as long as you don't change names<br>
configured, regardless of IP-addresses.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></div></div></blockquote></div><br></div>