简体   繁体   English

是否可以为Docker容器定制负载均衡器?

[英]Is a customized load-balancer for Docker containers possible?

I am deploying my application which contains three services by using Docker Swarm. 我正在使用Docker Swarm部署包含三个服务的应用程序。 As what i've read so far, Docker Swarm has a load-balancer to distribute container over Worker nodes automatically based on some internal factors. 正如我到目前为止所读到的,Docker Swarm有一个负载平衡器,可以根据一些内部因素自动在Worker节点上分发容器。 That is cool! 太棒了! but what i really need is a load-balancer which uses a set of parameters provided by me to distribute containers. 但我真正需要的是一个负载均衡器,它使用我提供的一组参数来分配容器。 Is it possible or it is too ambitious? 它有可能还是太雄心勃勃?
A set of parameters i mentioned here is obtained by running a script or code which calculate cpu usage, bandwidth, etc. Then its results will be passed to the load-balancer for distributing decision. 我在这里提到的一组参数是通过运行计算CPU使用率,带宽等的脚本或代码获得的。然后将其结果传递给负载均衡器以进行分发决策。

Thanks everyone for reading my post. 感谢大家阅读我的帖子。

Yes, this is perfectly possible but you will end up setting whole system on your own. 是的,这是完全可能的,但你最终会自己设置整个系统。 You can also use Nginx for proxy, fetch metrics from docker swarm or prometheus and pass the info to script to generate the upstream in nginx and reload nginx. 您还可以使用Nginx进行代理,从docker swarm或prometheus获取指标,并将信息传递给脚本以在nginx中生成上游并重新加载nginx。

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

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