clarify update-delay and rolling update behavior

Signed-off-by: Charles Smith <charles.smith@docker.com>
(cherry picked from commit 68a9224bd42437e63972dc9c3374c065872363b3)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Charles Smith 2016-07-11 20:06:56 -07:00 committed by Tibor Vass
parent ece06aee06
commit 14835b6834
1 changed files with 30 additions and 11 deletions

View File

@ -22,24 +22,34 @@ Redis 3.0.7 container image using rolling updates.
run your manager node. For example, the tutorial uses a machine named run your manager node. For example, the tutorial uses a machine named
`manager1`. `manager1`.
2. Deploy Redis 3.0.6 to the swarm and configure the swarm to update one node 2. Deploy Redis 3.0.6 to the swarm and configure the swarm with a 10 second
every 10 seconds: update delay:
```bash ```bash
$ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 $ docker service create \
--replicas 3 \
--name redis \
--update-delay 10s \
--update-parallelism 1 \
redis:3.0.6
0u6a4s31ybk7yw2wyvtikmu50 0u6a4s31ybk7yw2wyvtikmu50
``` ```
You configure the rolling update policy at service deployment time. You configure the rolling update policy at service deployment time.
The `--update-parallelism` flag configures the number of service tasks The `--update-parallelism` flag configures the number of service tasks that
to update simultaneously. the scheduler can update simultaneously. When updates to individual tasks
return a state of `RUNNING` or `FAILED`, the scheduler schedules another
task to update until all tasks are updated.
The `--update-delay` flag configures the time delay between updates to a The `--update-delay` flag configures the time delay between updates to a
service task or sets of tasks. You can describe the time `T` as a service task or sets of tasks.
combination of the number of seconds `Ts`, minutes `Tm`, or hours `Th`. So
`10m30s` indicates a 10 minute 30 second delay. You can describe the time `T` as a combination of the number of seconds
`Ts`, minutes `Tm`, or hours `Th`. So `10m30s` indicates a 10 minute 30
second delay.
3. Inspect the `redis` service: 3. Inspect the `redis` service:
@ -51,6 +61,7 @@ every 10 seconds:
Mode: Replicated Mode: Replicated
Replicas: 3 Replicas: 3
Placement: Placement:
Strategy: Spread
UpdateConfig: UpdateConfig:
Parallelism: 1 Parallelism: 1
Delay: 10s Delay: 10s
@ -67,6 +78,14 @@ applies the update to nodes according to the `UpdateConfig` policy:
redis redis
``` ```
The scheduler applies rolling updates as follows:
* Stop the initial number of tasks according to `--update-parallelism`.
* Schedule updates for the stopped tasks.
* Start the containers for the updated tasks.
* After an update to a task completes, wait for the specified delay
period before stopping the next task.
5. Run `docker service inspect --pretty redis` to see the new image in the 5. Run `docker service inspect --pretty redis` to see the new image in the
desired state: desired state:
@ -78,6 +97,7 @@ desired state:
Mode: Replicated Mode: Replicated
Replicas: 3 Replicas: 3
Placement: Placement:
Strategy: Spread
UpdateConfig: UpdateConfig:
Parallelism: 1 Parallelism: 1
Delay: 10s Delay: 10s
@ -99,7 +119,6 @@ desired state:
Before Swarm updates all of the tasks, you can see that some are running Before Swarm updates all of the tasks, you can see that some are running
`redis:3.0.6` while others are running `redis:3.0.7`. The output above shows `redis:3.0.6` while others are running `redis:3.0.7`. The output above shows
the state once the rolling updates are done. You can see that each instances the state once the rolling updates are done.
entered the `RUNNING` state in approximately 10 second increments.
Next, learn about how to [drain a node](drain-node.md) in the Swarm. Next, learn about how to [drain a node](drain-node.md) in the Swarm.