如何在docker群组上配置自动缩放? [英] How to configure autoscaling on docker swarm?

查看:196
本文介绍了如何在docker群组上配置自动缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在码头游戏群中是新的。我想知道如何配置此工具,从最少数量的节点开始,并在需要时增加到最大数量的节点。



应该使用另一个工具或码头工程群可以为我解决这个问题吗?

解决方案

简答案:没有容易Docker Swarm(或Swarm模式)不支持开箱即用的自动缩放计算机。



。您需要使用其他解决方案,例如 docker-machine 在基础设施上创建机器(使用docker),并将其链接到现有的Swarm群集(使用 docker swarm join )。



这将涉及很多脚本,但是想法是监视CPU /内存/网络使用情况(使用顶部 monit ),一旦超出阈值(例如 70% em>总集群资源),您触发一个调用 docker-machine 的脚本来扩展集群。使用相同的想法,您也可以从现有群组中排除删除节点(最好代理节点)如果您要使用此条件,或者您将拥有您的基础设施产卵,您需要确保正在监控持续的资源使用情况。



并且可以节省资源使用频繁和突然变化的节点。



您可以为集群中的机器定义一个下限和上限,以使事情受到控制。 / p>

请注意,Swarm需要至少3个 Manager 节点(推荐5)来维护分布式共识算法的法定人数。所以最小推荐下限是5个节点(可以使用 Agent 节点延伸,因为资源正在逐渐被服务使用)。 >

在某种程度上,您还可以查看 Docker InfraKit Terraform for 基础架构自动化健康监控


I'm new on docker swarm. I'd like to know how to configure this tool to start with a minimum number of nodes and grow to a maximum number of nodes when it is required.

Should I use another tool or can docker swarm solve this for me?

解决方案

Short answer: There is no easy way to do this with Docker Swarm for now.

Docker Swarm (or Swarm mode) does not support auto-scaling machines out of the box. You'd need to use another solution for that like docker-machine to create machines (with docker) on your infrastructure and link these to the existing Swarm cluster (with docker swarm join).

This will involve a lot of scripting but the idea is to monitor the cluster for CPU / Memory / Network usage (with top or monit) and once it goes beyond a threshold (say 70% of total cluster resources), you trigger a script calling docker-machine to scale up the cluster. Using the same idea you can also scale down by draining and removing nodes (preferably Agent nodes) from the existing swarm cluster once your are below the lower threshold.

You need to make sure you are monitoring for sustained resource usage if you want to use this criteria or you will have your Infrastructure spawning and destroying nodes from the frequent and sudden changes in resource usage.

You can define a lower bound and an upper bound for machines in the cluster to keep things under control.

Note that Swarm requires at least 3 Manager nodes (recommended 5) to maintain a quorum for the Distributed Consensus algorithm. So the minimum recommended lower bound is 5 nodes (which you can extend with Agent nodes as resources are incrementally being used by services).

To some extent, you can also take a look at Docker InfraKit or Terraform for Infrastructure automation and Health monitoring.

这篇关于如何在docker群组上配置自动缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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