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