简体   繁体   English

如何使用Nginx流模块对多个Netty TCP套接字服务器进行负载平衡?

[英]How to load balancing multiple Netty TCP socket server with nginx stream module?

I need load balancing tcp socket connections to multiple netty.io server. 我需要负载均衡tcp套接字连接到多个netty.io服务器。 At nginx 1.9, it has stream-module, it support load balancing tcp socket. 在nginx 1.9上,它具有流模块,它支持负载平衡tcp套接字。 I test success with 1 traccar server. 我用1台traccar服务器测试了成功。 Nginx listener port 5095 and forward package to port 5005 of traccar server. Nginx侦听器端口5095并将程序包转发到traccar服务器的端口5005。 But with multiple server, problem will happen. 但是对于多台服务器,问题将会发生。 DeviceX open socket to serverA, but will send package to serverB. DeviceX打开到serverA的套接字,但会将包发送到serverB。

Please give me advice! 请给我建议! Thank you very much. 非常感谢你。

I test with module stream.I have 3 server X,Y,Z, and 3 client A,B,C. 我使用模块流进行测试。我有3个服务器X,Y,Z和3个客户端A,B,C。 And I don't see problem loss connected as I think. 而且我没有看到像我想的那样造成的损失问题。 ClientA open socket to serverX,and communication is always send to ServerX. ClientA打开serverX的套接字,并且通信始终发送到ServerX。 If ClientA close connection socket and reopen it, clientA will communicate to ServerY, and communication is always send to ServerY. 如果ClientA关闭连接套接字并重新打开,则clientA将与ServerY通信,并且通信始终发送到ServerY。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM