open-consul/website/content/commands/members.mdx
hc-github-team-consul-core 74e6e8f66a
Backport of member cli: add -filter expression to flags into release/1.16.x (#18276)
* backport of commit fe571c6c3e88e828e68172c1eb22b338e614635b

* backport of commit 779901b6cd428e1b5116a9fe33ff5f88ce27e88b

* backport of commit adfa76146adabd4a6ed54f067e6e3e886d5c198f

---------

Co-authored-by: cskh <hui.kang@hashicorp.com>
2023-07-25 14:57:08 -04:00

64 lines
2 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Members'
description: >-
The `members` command outputs the current list of members that a Consul agent
knows about, along with their state. The state of a node can only be alive,
left, or failed.
---
# Consul Members
Command: `consul members`
Corresponding HTTP API Endpoint: [\[GET\] /v1/agent/members](/consul/api-docs/agent#list-members)
The `members` command outputs the current list of members that a Consul
agent knows about, along with their state. The state of a node can only
be "alive", "left", or "failed".
Nodes in the "failed" state are still listed because Consul attempts to
reconnect with failed nodes for a certain amount of time in the case
that the failure is actually just a network partition.
The table below shows this command's [required ACLs](/consul/api-docs/api-structure#authentication). Configuration of
[blocking queries](/consul/api-docs/features/blocking) and [agent caching](/consul/api-docs/features/caching)
are not supported from commands, but may be from the corresponding HTTP endpoint.
| ACL Required |
| ------------ |
| `node:read` |
## Usage
Usage: `consul members [options]`
#### Command Options
- `-detailed` - If provided, output shows more detailed information
about each node.
- `-segment` <EnterpriseAlert inline /> - The segment to show members in. If not provided, members
in all segments visible to the agent will be listed.
- `-status` - If provided, output is filtered to only nodes matching
the regular expression for status
- `-wan` - For agents in Server mode, this will return the list of nodes
in the WAN gossip pool. These are generally all the server nodes in
each datacenter.
- `-filter=<filter>` - Expression to use for filtering the results,
e.g., `-filter='Tags["dc"] == dc2'`.
See the [`/catalog/nodes` API documentation](/consul/api-docs/catalog#filtering) for a
description of what is filterable.
#### Enterprise Options
@include 'http_api_partition_options.mdx'
#### API Options
@include 'http_api_options_client.mdx'