Skip to content
Latchkey

consul members: List Consul Cluster Nodes in CI

consul members prints the nodes in the local Consul datacenter as seen by the gossip (Serf) layer.

Before a pipeline talks to Consul it helps to confirm the agent is up and joined. members is the cheapest health probe: if it returns the cluster is reachable.

What it does

consul members queries the local agent and lists every member of the gossip pool with its name, address, status (alive, left, failed), type (client or server), and protocol version. It reflects Serf membership, not service health.

Common usage

Terminal
consul members
consul members -detailed
consul members -status alive
consul members -wan        # members across WAN-federated datacenters

Options

FlagWhat it does
-detailedShow extra Serf tags and metadata per member
-status <regex>Filter members whose status matches the regex
-wanList members in the WAN gossip pool (server federation)
-segment <name>Filter to a network segment (Enterprise)
-http-addr <addr>Address of the agent HTTP API (or CONSUL_HTTP_ADDR)

In CI

Use consul members as a readiness gate in a job that depends on Consul: loop on it until a server shows status alive before running service registration or KV reads. It needs only the agent address, no ACL token.

Common errors in CI

"Error retrieving members: Get ... dial tcp 127.0.0.1:8500: connect: connection refused" means no agent is running on the default HTTP address; start one or set CONSUL_HTTP_ADDR. "Unexpected response code: 403 (Permission denied)" appears only when default deny ACLs gate the agent endpoint; supply CONSUL_HTTP_TOKEN.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →