zl程序教程

您现在的位置是:首页 >  云平台

当前栏目

nginx TCP负载均衡ip哈希写法

负载NginxTCPIP哈希 均衡 写法
2023-09-11 14:19:26 时间
stream {
    upstream netty {
        hash $remote_addr;
        server s1:30020;
        server s2:30020;
    }
    server {
        listen 30001;
        proxy_pass netty;
    }
}
ip_hash这种配置方法在这里报错,需要改成上边那种写法。
hash $remote_addr;即为根据ip进行hash。