Load balancing based on hash of the domain
Bram
bramverdonck at telenet.be
Tue Dec 15 10:56:43 UTC 2015
Problem is that it will not accept anything besides $remote_addr and $request_uri.
For example:
upstream loadbalancer {
hash $server_name consistent:
#hash $request_uri consistent;
server 10.0.0.1:8080;
server 10.0.0.2:8080;
}
Will fail with:
invalid number of arguments in "hash" directive in /etc/nginx/nginx-loadbalancing.conf:6
> Op 15-dec.-2015, om 10:58 heeft Valentin V. Bartenev <vbart at nginx.com> het volgende geschreven:
>
> On Tuesday 15 December 2015 10:13:35 Bram Verdonck wrote:
>> Hi all,
>>
>>
>> I wish to use load balancing in front of a shared webhosting cluster with multiple domains.
>> To make optimal use of resources, it would make sense to do load balancing based on domain instead of random or based on IP.
>> I noticed that there is a hash parameter but I’m unable to use $server_name or $host as a parameter, only $request_uri and $remote_addr.
>>
>> Is there any way that I could use $server_name?
>>
>> In my opinion it makes no sense to randomize all requests for the different domains and would make sense to load balance based on a hash of the domain.
>>
>
> What's the problem with the "hash" directive of upstream block?
> Why can't you use it?
>
> http://nginx.org/r/hash
>
> wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list