github.com/smintz/nomad@v0.8.3/website/source/docs/job-specification/migrate.html.md (about)

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