问题
I have made a game where clients connect to a central server with TCP connection. In the first 6 bytes I send the version number "00.00.01" of the client protocol. Based on this version I want to route/proxy the tcp connection to different servers where different version of the game will be running.
Basically client-1 with version 00.00.01 should connect to Server-1 And client 2 with version 00.00.02 should connect to Server-2
For load balancing I checked HAProxy lua support but couldn't find the solution. Does this kind of solution exist in NginX?
What are the best practices around?
回答1:
Why not have the game itself know which hostname to connect to? Then you can use DNS and virtual hosting to manage which physical machine that ends up mapping to.
来源:https://stackoverflow.com/questions/35837978/tcp-load-balancing-and-rerouting-based-on-first-few-bytes