使用 Nginx 进行 TCP 路由
TCP routing with Nginx
我正在尝试通过 TCP 层使用 Nginx 进行路由。
我有多个不同的数据库,我需要根据规则或 API
收到的请求执行从 API 到它们的路由
+++++ +++++++++++++ +++++++--------> mysqlServer(managerDb)
+API+ ----->+MySQLClient+---->+Nginx+--------> mysqlServer(customerDb)
+++++ +++++++++++++ +++++++--------> mysqlServer(........Db)
我已经做了典型的负载均衡,但我希望它根据请求进行路由
谢谢
Nginx主要工作在第7层(application), what you need is something at layer 4 (transport) for this HAProxy could better help to achieve what you need since it can do both HTTP and TCP (db load balancing with HAProxy example)
也许通过使用 Nginx plus 你也可以做同样的事情,查看这篇关于如何做的文章 layer 4 load balancing。
另请参阅 TCP and UDP load balancing,需要使用 --with-stream
配置标志构建的最新开源 Nginx。
这里有一篇文章解释了如何使用 HAProxy 进行负载平衡
我正在尝试通过 TCP 层使用 Nginx 进行路由。 我有多个不同的数据库,我需要根据规则或 API
收到的请求执行从 API 到它们的路由+++++ +++++++++++++ +++++++--------> mysqlServer(managerDb)
+API+ ----->+MySQLClient+---->+Nginx+--------> mysqlServer(customerDb)
+++++ +++++++++++++ +++++++--------> mysqlServer(........Db)
我已经做了典型的负载均衡,但我希望它根据请求进行路由
谢谢
Nginx主要工作在第7层(application), what you need is something at layer 4 (transport) for this HAProxy could better help to achieve what you need since it can do both HTTP and TCP (db load balancing with HAProxy example)
也许通过使用 Nginx plus 你也可以做同样的事情,查看这篇关于如何做的文章 layer 4 load balancing。
另请参阅 TCP and UDP load balancing,需要使用 --with-stream
配置标志构建的最新开源 Nginx。
这里有一篇文章解释了如何使用 HAProxy 进行负载平衡