Signed-off-by: Charles Smith <charles.smith@docker.com>
(cherry picked from commit 68a9224bd42437e63972dc9c3374c065872363b3)
Signed-off-by: Tibor Vass <tibor@docker.com>
| ... | ... |
@@ -22,24 +22,34 @@ Redis 3.0.7 container image using rolling updates. |
| 22 | 22 |
run your manager node. For example, the tutorial uses a machine named |
| 23 | 23 |
`manager1`. |
| 24 | 24 |
|
| 25 |
-2. Deploy Redis 3.0.6 to the swarm and configure the swarm to update one node |
|
| 26 |
-every 10 seconds: |
|
| 25 |
+2. Deploy Redis 3.0.6 to the swarm and configure the swarm with a 10 second |
|
| 26 |
+update delay: |
|
| 27 | 27 |
|
| 28 | 28 |
```bash |
| 29 |
- $ docker service create --replicas 3 --name redis --update-delay 10s --update-parallelism 1 redis:3.0.6 |
|
| 29 |
+ $ docker service create \ |
|
| 30 |
+ --replicas 3 \ |
|
| 31 |
+ --name redis \ |
|
| 32 |
+ --update-delay 10s \ |
|
| 33 |
+ --update-parallelism 1 \ |
|
| 34 |
+ redis:3.0.6 |
|
| 30 | 35 |
|
| 31 | 36 |
0u6a4s31ybk7yw2wyvtikmu50 |
| 32 | 37 |
``` |
| 33 | 38 |
|
| 34 | 39 |
You configure the rolling update policy at service deployment time. |
| 35 | 40 |
|
| 36 |
- The `--update-parallelism` flag configures the number of service tasks |
|
| 37 |
- to update simultaneously. |
|
| 41 |
+ The `--update-parallelism` flag configures the number of service tasks that |
|
| 42 |
+ the scheduler can update simultaneously. When updates to individual tasks |
|
| 43 |
+ return a state of `RUNNING` or `FAILED`, the scheduler schedules another |
|
| 44 |
+ task to update until all tasks are updated. |
|
| 38 | 45 |
|
| 39 | 46 |
The `--update-delay` flag configures the time delay between updates to a |
| 40 |
- service task or sets of tasks. You can describe the time `T` as a |
|
| 41 |
- combination of the number of seconds `Ts`, minutes `Tm`, or hours `Th`. So |
|
| 42 |
- `10m30s` indicates a 10 minute 30 second delay. |
|
| 47 |
+ service task or sets of tasks. |
|
| 48 |
+ |
|
| 49 |
+ You can describe the time `T` as a combination of the number of seconds |
|
| 50 |
+ `Ts`, minutes `Tm`, or hours `Th`. So `10m30s` indicates a 10 minute 30 |
|
| 51 |
+ second delay. |
|
| 52 |
+ |
|
| 43 | 53 |
|
| 44 | 54 |
3. Inspect the `redis` service: |
| 45 | 55 |
|
| ... | ... |
@@ -51,6 +61,7 @@ every 10 seconds: |
| 51 | 51 |
Mode: Replicated |
| 52 | 52 |
Replicas: 3 |
| 53 | 53 |
Placement: |
| 54 |
+ Strategy: Spread |
|
| 54 | 55 |
UpdateConfig: |
| 55 | 56 |
Parallelism: 1 |
| 56 | 57 |
Delay: 10s |
| ... | ... |
@@ -67,6 +78,14 @@ applies the update to nodes according to the `UpdateConfig` policy: |
| 67 | 67 |
redis |
| 68 | 68 |
``` |
| 69 | 69 |
|
| 70 |
+ The scheduler applies rolling updates as follows: |
|
| 71 |
+ |
|
| 72 |
+ * Stop the initial number of tasks according to `--update-parallelism`. |
|
| 73 |
+ * Schedule updates for the stopped tasks. |
|
| 74 |
+ * Start the containers for the updated tasks. |
|
| 75 |
+ * After an update to a task completes, wait for the specified delay |
|
| 76 |
+ period before stopping the next task. |
|
| 77 |
+ |
|
| 70 | 78 |
5. Run `docker service inspect --pretty redis` to see the new image in the |
| 71 | 79 |
desired state: |
| 72 | 80 |
|
| ... | ... |
@@ -78,13 +97,14 @@ desired state: |
| 78 | 78 |
Mode: Replicated |
| 79 | 79 |
Replicas: 3 |
| 80 | 80 |
Placement: |
| 81 |
+ Strategy: Spread |
|
| 81 | 82 |
UpdateConfig: |
| 82 | 83 |
Parallelism: 1 |
| 83 | 84 |
Delay: 10s |
| 84 | 85 |
ContainerSpec: |
| 85 | 86 |
Image: redis:3.0.7 |
| 86 | 87 |
Resources: |
| 87 |
- ``` |
|
| 88 |
+ ``` |
|
| 88 | 89 |
|
| 89 | 90 |
6. Run `docker service tasks <TASK-ID>` to watch the rolling update: |
| 90 | 91 |
|
| ... | ... |
@@ -99,7 +119,6 @@ desired state: |
| 99 | 99 |
|
| 100 | 100 |
Before Swarm updates all of the tasks, you can see that some are running |
| 101 | 101 |
`redis:3.0.6` while others are running `redis:3.0.7`. The output above shows |
| 102 |
- the state once the rolling updates are done. You can see that each instances |
|
| 103 |
- entered the `RUNNING` state in approximately 10 second increments. |
|
| 102 |
+ the state once the rolling updates are done. |
|
| 104 | 103 |
|
| 105 | 104 |
Next, learn about how to [drain a node](drain-node.md) in the Swarm. |