Files
nomad/website/content/docs/commands/server/force-leave.mdx
Gerard Nguyen 1339599185 cli: Add prune flag for nomad server force-leave command (#18463)
This feature will help operator to remove a failed/left node from Serf layer immediately
without waiting for 24 hours for the node to be reaped

* Update CLI with prune flag
* Update API /v1/agent/force-leave with prune query string parameter
* Update CLI and API doc
* Add unit test
2023-09-15 08:45:11 -04:00

56 lines
1.3 KiB
Plaintext

---
layout: docs
page_title: 'Commands: server force-leave'
description: >
The server force-leave command is used to force a server into the "left"
state.
---
# Command: server force-leave
The `server force-leave` command forces a server to enter the "left" state.
This can be used to eject server nodes which have failed and will not rejoin
the cluster. The failed or left server will be garbage collected after `24h`.
~> Note that if the server is actually still alive, it will
eventually rejoin the cluster again.
## Usage
```plaintext
nomad server force-leave [options] <node>
```
This command expects only one argument - the node which should be forced
to enter the "left" state.
Additionally, by specifying the `prune` flag, a failed or left node can be forcibly removed
from the list of members immediately.
If ACLs are enabled, this option requires a token with the `agent:write`
capability.
## General Options
@include 'general_options_no_namespace.mdx'
## Server Force-Leave Options
- `-prune`: Removes failed or left server from the Serf member list immediately.
If member is actually still alive, it will eventually rejoin the cluster again.
## Examples
Force-leave the server "node1":
```shell-session
$ nomad server force-leave node1
```
Force-leave the server "node1" and prune it:
```shell-session
$ nomad server force-leave -prune node1
```