负载均衡 ip_hash 与一致性哈希算法

负载均衡 ip_hash

ip_hash 可以保证用户访问可以请求到上游服务中的固定的服务器,前提是用户ip没有发生更改。

使用ip_hash的注意点:

不能把后台服务器直接移除,只能标记 down .否则会导致hash算法更改,会话和缓存也都失效了。

If one of the servers needs to be temporarily removed, it should be marked with the down parameter in order to preserve the current hashing of client IP add

upstream tomcats {

ip_hash;

server 192.168.1.173:8080;

server 192.168.1.174:8080 down;

server 192.168.1.175:8080;

}


©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容