github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/job-specification/migrate.mdx (about) 1 --- 2 layout: docs 3 page_title: migrate Stanza - Job Specification 4 sidebar_title: migrate 5 description: |- 6 The "migrate" stanza specifies the group's migrate strategy. The migrate 7 strategy is used to control the job's behavior when it is being migrated off 8 of a draining node. 9 --- 10 11 # `migrate` Stanza 12 13 <Placement 14 groups={[ 15 ['job', 'migrate'], 16 ['job', 'group', 'migrate'] 17 ]} 18 /> 19 20 The `migrate` stanza specifies the group's strategy for migrating off of 21 [draining][drain] nodes. If omitted, a default migration strategy is applied. 22 If specified at the job level, the configuration will apply to all groups 23 within the job. Only service jobs with a count greater than 1 support migrate 24 stanzas. 25 26 ```hcl 27 job "docs" { 28 migrate { 29 max_parallel = 1 30 health_check = "checks" 31 min_healthy_time = "10s" 32 healthy_deadline = "5m" 33 } 34 } 35 ``` 36 37 When one or more nodes are draining, only `max_parallel` allocations will be 38 stopped at a time. Node draining will not continue until replacement 39 allocations have been healthy for their `min_healthy_time` or 40 `healthy_deadline` is reached. 41 42 Note that a node's drain [deadline][deadline] will override the `migrate` 43 stanza for allocations on that node. The `migrate` stanza is for job authors to 44 define how their services should be migrated, while the node drain deadline is 45 for system operators to put hard limits on how long a drain may take. 46 47 See the [Workload Migration Guide](https://learn.hashicorp.com/nomad/operating-nomad/node-draining) for details 48 on node draining. 49 50 ## `migrate` Parameters 51 52 - `max_parallel` `(int: 1)` - Specifies the number of allocations that can be 53 migrated at the same time. This number must be less than the total 54 [`count`][count] for the group as `count - max_parallel` will be left running 55 during migrations. 56 57 - `health_check` `(string: "checks")` - Specifies the mechanism in which 58 allocations health is determined. The potential values are: 59 60 - "checks" - Specifies that the allocation should be considered healthy when 61 all of its tasks are running and their associated [checks][checks] are 62 healthy, and unhealthy if any of the tasks fail or not all checks become 63 healthy. This is a superset of "task_states" mode. 64 65 - "task_states" - Specifies that the allocation should be considered healthy when 66 all its tasks are running and unhealthy if tasks fail. 67 68 - `min_healthy_time` `(string: "10s")` - Specifies the minimum time the 69 allocation must be in the healthy state before it is marked as healthy and 70 unblocks further allocations from being migrated. This is specified using a 71 label suffix like "30s" or "15m". 72 73 - `healthy_deadline` `(string: "5m")` - Specifies the deadline in which the 74 allocation must be marked as healthy after which the allocation is 75 automatically transitioned to unhealthy. This is specified using a label 76 suffix like "2m" or "1h". 77 78 [checks]: /docs/job-specification/service#check-parameters 79 [count]: /docs/job-specification/group#count 80 [drain]: /docs/commands/node/drain 81 [deadline]: /docs/commands/node/drain#deadline