scale the service in the swarm

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scale the service in the swarm相关的知识,希望对你有一定的参考价值。

一旦你部署了一个服务到swarm集群中,你就可以使用docker命令行来伸缩扩容运行该服务的容器数量。运行在多个容器的一个服务叫做tasks 任务。


$docker machine ssh manager1

$ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS>

$ docker service scale helloworld=5
helloworld scaled to 5


查看扩容的服务列表:


docker service ps <SERVICE-ID>


$ docker service ps helloworld
NAME                                    IMAGE   NODE      DESIRED STATE  CURRENT STATE
helloworld.1.8p1vev3fq5zm0mi8g0as41w35  alpine  worker2   Running        Running 7 minutes
helloworld.2.c7a7tcdq5s0uk3qr88mf8xco6  alpine  worker1   Running        Running 24 seconds
helloworld.3.6crl09vdcalvtfehfh69ogfb1  alpine  worker1   Running        Running 24 seconds
helloworld.4.auky6trawmdlcne8ad8phb0f1  alpine  manager1  Running        Running 24 seconds
helloworld.5.ba19kca06l18zujfwxyc5lkyn  alpine  worker2   Running        Running 24 seconds


你可以看到swarm已经创建了4个新的任务,总共扩容到5个运行的实例

这些任务分布在swarm集群的三个节点中。其中一个是运行在manager1中。


在manager1 执行  docker ps 

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
528d68040f95        alpine:latest       "ping docker.com"   About a minute ago   Up About a minute                       helloworld.4.auky6trawmdlcne8ad8phb0f1


本文出自 “清风柳絮” 博客,请务必保留此出处http://binuu.blog.51cto.com/801317/1942371

以上是关于scale the service in the swarm的主要内容,如果未能解决你的问题,请参考以下文章

sklearn 逻辑回归Increase the number of iterations (max_iter) or scale the data as shown in解决方案

dubbo异常: Failed to invoke the method getXXXX in the service 异常解决方案

Name Error Connection “:1.33“ is not allowed to own the service “x“ due to security policies in the

翻译:Interest in teaching,social service and the humanities

[转]what’s the difference between @Component ,@Repository & @Service annotations in Spring

What's the difference between @Component, @Repository & @Service annotations in Spring?(代码片段