[英]How services are distributed in docker swarm
Can I somehow configure how master node distributes services in docker swarm? 我可以以某种方式配置主节点如何在docker swarm中分配服务吗? I thought, that it should see free resources of worker nodes and distribute it to "freest" node.
我认为,它应该看到工作程序节点的空闲资源并将其分发到“最空闲”节点。
Currently I have problem, that service is distributed into one node, which is full (90% RAM) and it starts be laggy, but at the same time second node has few services and it can handle another one. 目前,我有一个问题,该服务被分配到一个节点上,该节点已满(RAM占90%),开始时比较迟钝,但与此同时,第二个节点几乎没有服务,并且可以处理另一个节点。
docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
wdkklpy6065zxckxyuj000ei4 * docker-master Ready Drain Leader 18.09.6
sk45rol2whdr5eh2jqozy0035 docker-node01 Ready Active Reachable 18.09.6
o4zwwbwwcrbwo4tsd00pxkfuc docker-node02 Ready Active 18.09.6
Now I have 36 (very similar) services, 28 run on docker-node01, 8 on docker-node02. 现在我有36个(非常相似)服务,其中28个在docker-node01上运行,另外8个在docker-node02上运行。 I thought, that ideal state is 16 services on both nodes.
我认为,理想状态是两个节点上都有16个服务。 Both docker-nodes are same.
两个docker-nodes都相同。
According to the swarmkit project README the only available strategy is spread
so it schedule tasks on the least loaded modes. 根据swarmkit项目README的说法,唯一可用的策略是
spread
因此它以最小负载模式调度任务。
Note that the swarm won't move nodes around to maintain this strategy so if you added the node02 after the node01 was full then the node02 will remain mostly empty. 请注意,群集不会移动节点来维持此策略,因此,如果在node01已满后添加了node02,则node02将大部分保持为空。 You could drain both nodes then activate them to see if it distributes better the load.
您可以耗尽两个节点,然后激活它们以查看它是否更好地分配了负载。
You can find a more detailed description on the schedules algorithm on the project documentation: scheduling-algorithm 您可以在项目文档中找到有关调度算法的更详细的描述:schedule -algorithm
For the older swarm manager this attribute was configurable: https://docs.docker.com/swarm/reference/manage/#--strategy--scheduler-placement-strategy 对于较旧的群组管理器,此属性是可配置的: https : //docs.docker.com/swarm/reference/manage/#--strategy--scheduler-placement-strategy
我还找到了https://docs.docker.com/swarm/scheduler/strategy/ ,它解释了很多有关Docker群策略的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.