Docker Swarm负载平衡如何? [英] How does Docker Swarm load balance?

查看:217
本文介绍了Docker Swarm负载平衡如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组10个Swarm节点,通过 docker swarm join 命令开始

I have a cluster of 10 Swarm nodes started via docker swarm join command

如果我想缩放通过

docker service create --replicas 15 

docker群组如何知道启动容器的位置?

how does docker swarm know where to start the container?

是循环还是循环考虑到计算资源(使用多少cpu / mem)?

is it round-robin or does it take into consideration of compute resource (how much cpu/mem being used)?

推荐答案

当您创建服务或将其缩放调度程序选举领导者(其中一名经理)将选择一个节点来运行服务。领导者目前有3种策略。

When you create a service or scale it in the Swarm mode, scheduler on Elected Leader (one of the managers) will choose a node to run the service on. There are 3 strategies currently available to the leader.


  • 传播

  • binpack

  • 随机

spread binpack 策略根据节点的可用CPU,其RAM和它所拥有的容器数量来计算排名。 random 策略不使用计算。它随机选择一个节点,主要用于调试。

The spread and binpack strategies compute rank according to a node’s available CPU, its RAM, and the number of containers it has. The random strategy uses no computation. It selects a node at random and is primarily intended for debugging.

spread 策略下,Swarm优化了具有最少数量容器的节点。 binpack 策略使Swarm对最包装的节点进行优化。

Under the spread strategy, Swarm optimizes for the node with the least number of containers. The binpack strategy causes Swarm to optimize for the node which is most packed.

Swarm默认使用传播。
请记住,您可以约束特定节点上的容器。

Swarm uses spread by default. Keep in mind you can Constraint Containers on specific nodes too.

不可能在Docker版本1.12.1(最新版本发布日期)中设置策略

这篇关于Docker Swarm负载平衡如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆