github.com/djenriquez/nomad-1@v0.8.1/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  ## `migrate` Parameters
    52  
    53  - `max_parallel` `(int: 1)` - Specifies the number of allocations that can be
    54    migrated at the same time. This number must be less than the total
    55    [`count`][count] for the group as `count - max_parallel` will be left running
    56    during migrations.
    57  
    58  - `health_check` `(string: "checks")` - Specifies the mechanism in which
    59    allocations health is determined. The potential values are:
    60  
    61    - "checks" - Specifies that the allocation should be considered healthy when
    62      all of its tasks are running and their associated [checks][checks] are
    63      healthy, and unhealthy if any of the tasks fail or not all checks become
    64      healthy.  This is a superset of "task_states" mode.
    65  
    66    - "task_states" - Specifies that the allocation should be considered healthy when
    67      all its tasks are running and unhealthy if tasks fail.
    68  
    69  - `min_healthy_time` `(string: "10s")` - Specifies the minimum time the
    70    allocation must be in the healthy state before it is marked as healthy and
    71    unblocks further allocations from being migrated. This is specified using a
    72    label suffix like "30s" or "15m".
    73  
    74  - `healthy_deadline` `(string: "5m")` - Specifies the deadline in which the
    75    allocation must be marked as healthy after which the allocation is
    76    automatically transitioned to unhealthy. This is specified using a label
    77    suffix like "2m" or "1h".
    78  
    79  
    80  [checks]: /docs/job-specification/service.html#check-parameters
    81  [count]: /docs/job-specification/group.html#count
    82  [drain]: /docs/commands/node/drain.html
    83  [deadline]: /docs/commands/node/drain.html#deadline