2017-02-15 21:30:07 +00:00
|
|
|
---
|
2020-04-07 18:55:19 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: Operator Raft'
|
2020-04-07 23:56:08 +00:00
|
|
|
sidebar_title: 'raft'
|
2020-04-07 18:55:19 +00:00
|
|
|
sidebar_current: docs-commands-operator-raft
|
2017-02-15 21:30:07 +00:00
|
|
|
description: >
|
2020-04-07 18:55:19 +00:00
|
|
|
The operator raft subcommand is used to view and modify Consul's Raft
|
|
|
|
configuration.
|
2017-02-15 21:30:07 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Operator Raft
|
|
|
|
|
|
|
|
Command: `consul operator raft`
|
|
|
|
|
|
|
|
The Raft operator command is used to interact with Consul's Raft subsystem. The
|
|
|
|
command can be used to verify Raft peers or in rare cases to recover quorum by
|
|
|
|
removing invalid peers.
|
|
|
|
|
|
|
|
```text
|
|
|
|
Usage: consul operator raft <subcommand> [options]
|
|
|
|
|
2017-02-16 19:44:14 +00:00
|
|
|
The Raft operator command is used to interact with Consul's Raft subsystem. The
|
|
|
|
command can be used to verify Raft peers or in rare cases to recover quorum by
|
|
|
|
removing invalid peers.
|
2017-02-15 21:30:07 +00:00
|
|
|
|
|
|
|
Subcommands:
|
|
|
|
|
|
|
|
list-peers Display the current Raft peer configuration
|
|
|
|
remove-peer Remove a Consul server from the Raft configuration
|
|
|
|
```
|
|
|
|
|
2017-02-16 19:44:14 +00:00
|
|
|
## list-peers
|
|
|
|
|
|
|
|
This command displays the current Raft peer configuration.
|
|
|
|
|
|
|
|
Usage: `consul operator raft list-peers -stale=[true|false]`
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-stale` - Optional and defaults to "false" which means the leader provides
|
|
|
|
the result. If the cluster is in an outage state without a leader, you may need
|
|
|
|
to set this to "true" to get the configuration from a non-leader server.
|
2017-02-16 19:44:14 +00:00
|
|
|
|
|
|
|
The output looks like this:
|
|
|
|
|
2020-04-07 23:56:08 +00:00
|
|
|
```text
|
2017-04-19 22:01:40 +00:00
|
|
|
Node ID Address State Voter RaftProtocol
|
|
|
|
alice 127.0.0.1:8300 127.0.0.1:8300 follower true 2
|
|
|
|
bob 127.0.0.2:8300 127.0.0.2:8300 leader true 3
|
|
|
|
carol 127.0.0.3:8300 127.0.0.3:8300 follower true 2
|
2017-02-16 19:44:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
`Node` is the node name of the server, as known to Consul, or "(unknown)" if
|
|
|
|
the node is stale and not known.
|
|
|
|
|
|
|
|
`ID` is the ID of the server. This is the same as the `Address` in Consul 0.7
|
2020-04-07 18:55:19 +00:00
|
|
|
but may be upgraded to a GUID in a future version of Consul.
|
2017-02-16 19:44:14 +00:00
|
|
|
|
|
|
|
`Address` is the IP:port for the server.
|
|
|
|
|
|
|
|
`State` is either "follower" or "leader" depending on the server's role in the
|
|
|
|
Raft configuration.
|
|
|
|
|
|
|
|
`Voter` is "true" or "false", indicating if the server has a vote in the Raft
|
|
|
|
configuration. Future versions of Consul may add support for non-voting servers.
|
|
|
|
|
|
|
|
## remove-peer
|
|
|
|
|
|
|
|
This command removes the Consul server with given address from the Raft configuration.
|
|
|
|
|
|
|
|
There are rare cases where a peer may be left behind in the Raft configuration
|
|
|
|
even though the server is no longer present and known to the cluster. This command
|
|
|
|
can be used to remove the failed server so that it is no longer affects the
|
|
|
|
Raft quorum. If the server still shows in the output of the
|
2020-04-09 23:46:54 +00:00
|
|
|
[`consul members`](/docs/commands/members) command, it is preferable to
|
2017-02-16 19:44:14 +00:00
|
|
|
clean up by simply running
|
2020-04-09 23:46:54 +00:00
|
|
|
[`consul force-leave`](/docs/commands/force-leave)
|
2017-02-16 19:44:14 +00:00
|
|
|
instead of this command.
|
|
|
|
|
|
|
|
Usage: `consul operator raft remove-peer -address="IP:port"`
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-address` - "IP:port" for the server to remove. The port number is usually
|
|
|
|
8300, unless configured otherwise.
|
2017-02-15 21:30:07 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-id` - ID of the server to remove.
|
2017-03-30 01:09:41 +00:00
|
|
|
|
2017-02-16 19:44:14 +00:00
|
|
|
The return code will indicate success or failure.
|