Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

docker - Docker群策略(Docker swarm strategy)

Can anyone share their experience of changing the docker swarm scheduling strategy as there are three (spread, binpack and random).

(任何人都可以分享他们更改docker swarm调度策略的经验,因为它有三种(扩展,binpack和random)。)

spread is default strategy used by docker swarm and I want it change to binpack.

(传播是docker swarm使用的默认策略,我希望将其更改为binpack。)

  ask by Niaz Hussain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Swarm scheduling strategies you've listed are for the Classic Swarm that is implemented as a standalone container that acts as a reverse proxy to various docker engines.

(您列出的Swarm调度策略适用于Classic Swarm,它是作为独立容器实现的,可充当各种Docker引擎的反向代理。)

Most everyone is using the newer Swarm Mode instead of this, and little development effort happens for Classic Swarm.

(大多数人都在使用较新的Swarm Mode而不是此模式,Classic Swarm的开发工作很少。)

The newer Swarm Mode includes a single option for the scheduler that can be tuned.

(较新的“群存模式”包括可调整的计划程序的单个选项。)

That single option is an HA Spread algorithm.

(唯一的选择是HA Spread算法。)

When you have multiple replicas of a single service, it will first seek to spread out those replicas across multiple nodes meeting the required criteria.

(当您有一个服务的多个副本时,它将首先设法将这些副本分布在满足所需条件的多个节点上。)

And among the nodes with the fewest replicas, it will pick the nodes with the fewest other scheduled containers first.

(在副本最少的节点中,它将首先选择其他调度的容器最少的节点。)

The tuning of this algorithm includes constraints and placement preferences.

(该算法的调整包括约束和放置首选项。)

Constraints allow you to require the service run on nodes with specific labels or platforms.

(约束允许您要求服务在具有特定标签或平台的节点上运行。)

And the placement preferences allow you to spread the workload across different values of a given label, which is useful to ensure all replicas are not running within the same AZ.

(通过放置首选项,您可以将工作负载分散在给定标签的不同值上,这对于确保所有副本不在同一可用区中运行非常有用。)

None of these configurations in Swarm Mode include a binpacking option.

(群集模式下的所有配置均未包含装箱选项。)

If you wish to reduce the number of nodes in your swarm cluster, then you can update the node state to drain workload from the node.

(如果您希望减少群集集群中的节点数,则可以更新节点状态以从节点上消耗工作量。)

This will gracefully stop all swarm managed containers on that node and migrate them to other nodes.

(这将正常停止该节点上的所有群集管理的容器,并将它们迁移到其他节点。)

Or you can simply pause new workloads from being scheduled on the node which will gradually remove replicas as services are updated and scheduled on other nodes, but not preemptively stop running replicas on that node.

(或者,您可以简单地暂停在节点上计划新的工作负载,这将随着服务在其他节点上的更新和计划而逐渐删除副本,但不能抢先停止在该节点上运行副本。)

These two options are controlled by docker node update --availability :

(这两个选项由docker node update --availability :)

$ docker node update --help

Usage:  docker node update [OPTIONS] NODE

Update a node

Options:
      --availability string   Availability of the node ("active"|"pause"|"drain")
      --label-add list        Add or update a node label (key=value)
      --label-rm list         Remove a node label if exists
      --role string           Role of the node ("worker"|"manager")

For more details on constraints and placement preferences, see: https://docs.docker.com/engine/reference/commandline/service_create/#specify-service-constraints---constraint

(有关约束和放置首选项的更多详细信息,请参见: https : //docs.docker.com/engine/reference/commandline/service_create/#specify-service-constraints---constraint)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...