2019-04-15 09:12:06 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: alloc restart'
|
|
|
|
description: |
|
2019-04-15 09:12:06 +00:00
|
|
|
Restart a running allocation or task
|
|
|
|
---
|
|
|
|
|
2019-06-05 15:09:22 +00:00
|
|
|
# Command: alloc restart
|
2019-04-15 09:12:06 +00:00
|
|
|
|
|
|
|
The `alloc restart` command allows a user to perform an in place restart of an
|
|
|
|
an entire allocation or individual task.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
```plaintext
|
2019-04-25 12:40:09 +00:00
|
|
|
nomad alloc restart [options] <allocation> <task>
|
2019-04-15 09:12:06 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
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 every task in the allocation will be restarted.
|
|
|
|
|
2021-07-07 16:58:16 +00:00
|
|
|
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.
|
|
|
|
|
2020-11-19 21:38:08 +00:00
|
|
|
When ACLs are enabled, this command requires a token with the
|
|
|
|
`alloc-lifecycle`, `read-job`, and `list-jobs` capabilities for the
|
|
|
|
allocation's namespace.
|
|
|
|
|
2019-04-15 09:12:06 +00:00
|
|
|
## General Options
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
@include 'general_options.mdx'
|
2019-04-15 09:12:06 +00:00
|
|
|
|
|
|
|
## Restart Options
|
|
|
|
|
2021-07-07 16:58:16 +00:00
|
|
|
- `-task`: Specify the individual task to restart.
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
- `-verbose`: Display verbose output.
|
2019-04-15 09:12:06 +00:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ nomad alloc restart eb17e557
|
2019-04-15 09:12:06 +00:00
|
|
|
|
|
|
|
$ nomad alloc restart eb17e557 foo
|
|
|
|
Could not find task named: foo, found:
|
|
|
|
* test
|
|
|
|
<blocking>
|
|
|
|
```
|
2021-07-07 16:58:16 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
```
|