<span id="Label3"></p><p><p>In the previous section, we have expanded multiple instances in a single service.</p></p><p><p>In this section, we deploy a service based on the redis3.0.6 container image.</p></p><p><p>Then upgrade to redis3.0.7 by rolling the upgrade</p></p><p><p><br></p></p><p><p>Docker machine SSH Manager1</p></p><p><p><br></p></p><p><p>Deploy redis3.0.6 in Swarm and configure Swarm 10-second update delay</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">$ docker Service Create--replicas 3--name Redis--update-delay 10s redis:3.0.60u6a4s31ybk7yw2wyvtikmu50</pre></pre><p><p><br></p></p><p><p>You can configure the policy for rolling updates at deployment time<br></p></p><p><p><br></p></p><p><p>The--update-delay parameter is used to configure the delay time of the update service or configuration task</p></p><p><p>T is used to describe the value of time<br></p></p><p><p>Ts indicates how many seconds</p></p><p><p>Tm indicates how many minutes</p></p><p><p>Th means how many hours</p></p><p><p><br></p></p><p><p>For example, 10m30s represents a delay of 10分钟30秒</p></p><p><p><br></p></p><p><p>By default, Scheduled Tasks update only one task at a Time.</p></p><p><p>The--update-parallelism parameter can be configured to update the maximum number of services concurrently</p></p><p><p><br></p></p><p><p>By default, when one updates a task, the returned status is Running. the scheduled task is scheduled to update the next until all tasks have been updated. If there are other updated tasks that return failed, the scheduled task will stop the Update.</p></p><p><p><br></p></p><p><p>You can control this behavior By--update-failure-action.</p></p><p><p>When using Docker service create or Docker service update</p></p><pre class="brush:bash;toolbar:false;"><pre class="brush:bash;toolbar:false;">$ docker Service Inspect--pretty Redisid:0u6a4s31ybk7yw2wyvtikmu50name:redisservice mode:repli cated replicas:3placement:strategy:spreadupdateconfig:parallelism:1 delay:10scontainerspec:image: Redis:3.0.6resources:endpoint MODE:VIP</pre></pre><p><p><br></p></p><p><p><br></p></p><p><p>Now you can update the image in the Swarm cluster.</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">$ docker Service Update--image redis:3.0.7 Redisredis</pre></pre><p><p><br></p></p><p><p>The default scrolling update steps are as Follows:</p></p> <ol class="list-paddingleft-2" style="list-style-type:decimal;"> <ol class="list-paddingleft-2" style="list-style-type:decimal;"> <li><p>Stop the first task</p></li> <li><p>Schedule an update to stop a task</p></li> <li><p>Start a task with the update complete</p></li> <li><p>If the updated task returns running, wait for the next delay period to update the next Task.</p></li> <li><p>If the update returns a failed, stop the update</p></li> </ol> </ol><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">$ docker Service Inspect--pretty Redisid:0u6a4s31ybk7yw2wyvtikmu50name:redisservice mode:repli cated replicas:3placement:strategy:spreadupdateconfig:parallelism:1 delay:10scontainerspec:image: Redis:3.0.7resources:endpoint MODE:VIP</pre></pre><p><p><br></p></p><p><p>If the update fails, the following information is Returned:<br></p></p><pre class="brush:bash;toolbar:false;"><pre class="brush:bash;toolbar:false;">$ docker Service Inspect--pretty Redisid:0u6a4s31ybk7yw2wyvtikmu50name:redis...snip ... Update status:State:paused started:11 seconds ago Message:update paused due to failure or early termination of Task 9p7ith557h8ndf0ui9s0q951b...snip ...</pre></pre><p><p><br></p></p><p><p>To restart a stopped update:<br></p></p><p><p>Docker Service Update <SERVICE-ID></p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Docker Service Update Redis</pre></pre><p><p>To prevent duplicate updates from failing, you may need to reconfigure the service with the following parameters<br></p></p><p><p><br></p></p><p><p>Docker Service Updatte.</p></p><p><p><br></p></p><p><p>Use the following command to view rolling updates</p></p><p><p>Docker Service PS <SERVICE-ID></p></p><p><p><br></p></p><pre class="brush:bash;toolbar:false">$ docker service ps redisname IMAGE NODE DESIRED STATE CURRENT STATE ERRORredis.1.dos1zffgeofhagnve8w864fco redis:3.0.7 worker1 Running running 37 seconds \_ redis.1.88rdo6pa52ki8oqx6dogf04fh redis:3.0.6 worker2 shutdown shutdown 56 seconds agoredis.2.9l3i4j85517skba5o7tn5m8g0 redis:3.0.7 worker2 running running about a minute \_ redis.2.66k185wilg8ele7ntu8f6nj6i redis:3.0.6 worker1 Shutdown Shutdown 2 minutes agoredis.3.egiuiqpzrdbxks3wxgn8qib1g redis:3.0.7 worker1 running running 48 seconds \_ redis.3.ctzktfddb2tepkr45qcmqln04 redis:3.0.6 mmanager1 Shutdown shutdown 2 minutes ago</pre><p><p><br></p></p><p><p><br></p></p><p><p>Before all the tasks are updated, you can see that some of the tasks are running redis:3.0.6, and some are redis:3.0.7</p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p><br></p></p><p><p>This article is from the "breeze willow" blog, please be sure to keep this source http://binuu.blog.51cto.com/801317/1942406</p></p><p><p>07_apply rolling updates to a service</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.