如何对 Websocket 应用进行负载均衡
发布网友
发布时间:2023-11-08 13:40
我来回答
共1个回答
热心网友
时间:2024-12-12 02:51
#nginx websocket 负载均衡配置
#回传消息 需要 uid+serverip+fd 绑定关系 来实现
#压测 可以用jmeter 或者 swoole作者写的 swoole-src/run.php at master · swoole/swoole-src · GitHub
#add 2016 0226
upstream websocket{
server serverip01;
server serverip02
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8020;
location / {
proxy_pass
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
#end