Linux 如何开始负载均衡?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3677073/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:12:07  来源:igfitidea点击:

How to get started with load balancing?

jspload-balancing

提问by RonTree

I have an JSP/Servlet web app that runs on one server. While this server holds up for now, I would like to add another server which will also give me the advantage of taking one down for maintenance/upgrade etc.

我有一个在一台服务器上运行的 JSP/Servlet Web 应用程序。虽然这台服务器现在可以运行,但我想添加另一台服务器,这也将使我能够停机进行维护/升级等。

The problem: I have no idea how to do this. How do I get a request that goes to a specific ip to go to two two different boxes depending on the load of the servers?

问题:我不知道如何做到这一点。根据服务器的负载,我如何获得一个去往特定 ip 的请求,以去往两个不同的盒子?

回答by Jeff Foster

You could start with a software load balancer - see HAProxyfor an example that's pretty easy to set up.

您可以从软件负载平衡器开始 - 请参阅HAProxy以获取非常容易设置的示例。