mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
* Enhance front matter description for search * acl section * alloc section * config section * deployment section * eval section * job section * license section * namespace section * node section * node pool section * operator section * plugin section * quota section * recommendation section * scaling section * sentinel section * server section * service section * setup section * system section * tls section * var section * volume section * change reference to command reference * Apply suggestions from code review Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> --------- Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
73 lines
2.0 KiB
Plaintext
73 lines
2.0 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: 'nomad alloc restart command reference'
|
|
description: |
|
|
The `nomad alloc restart` command restarts a running task or an entire allocation.
|
|
---
|
|
|
|
# `nomad alloc restart` command reference
|
|
|
|
The `alloc restart` command allows a user to perform an in place restart of an
|
|
an entire allocation or individual task.
|
|
|
|
## Usage
|
|
|
|
```plaintext
|
|
nomad alloc restart [options] <allocation> <task>
|
|
```
|
|
|
|
This command accepts a single allocation ID and a task name. The task name must
|
|
be part of the allocation and the task must be currently running. The task name
|
|
is optional and if omitted all tasks that are currently running will be
|
|
restarted.
|
|
|
|
Task name may also be specified using the `-task` option rather than a command
|
|
argument. If task name is given with both an argument and the `-task` option,
|
|
preference is given to the `-task` option.
|
|
|
|
Use the option `-all-tasks` to restart tasks that have already run, such as
|
|
non-sidecar prestart and poststart tasks.
|
|
|
|
When ACLs are enabled, this command requires a token with the
|
|
`alloc-lifecycle`, `read-job`, and `list-jobs` capabilities for the
|
|
allocation's namespace.
|
|
|
|
## General options
|
|
|
|
@include 'general_options.mdx'
|
|
|
|
## Restart options
|
|
|
|
- `-all-tasks`: If set, all tasks in the allocation will be restarted, even the
|
|
ones that already ran. This option cannot be used with `-task` or the
|
|
`<task>` argument.
|
|
|
|
- `-task`: Specify the individual task to restart. This option cannot be used
|
|
with `-all-tasks`.
|
|
|
|
- `-verbose`: Display verbose output.
|
|
|
|
## Examples
|
|
|
|
```shell-session
|
|
$ nomad alloc restart eb17e557
|
|
|
|
$ nomad alloc restart eb17e557 foo
|
|
Could not find task named: foo, found:
|
|
* test
|
|
<blocking>
|
|
```
|
|
|
|
Specifying task name with the `-task` option:
|
|
|
|
```shell-session
|
|
$ nomad alloc restart -task redis eb17e557
|
|
```
|
|
|
|
If task name is specified using both options, the command argument is ignored.
|
|
The following will restart the "redis" task only, not the "api" task:
|
|
|
|
```shell-session
|
|
$ nomad alloc restart -task redis eb17e557 api
|
|
```
|