catalog

Command: consul catalog

The catalog command is used to interact with Consul’s catalog via the command line. It exposes top-level commands for reading and filtering data from the registry.

The catalog is also accessible via the HTTP API.

Basic Examples

List all datacenters:

  1. $ consul catalog datacenters
  2. dc1
  3. dc2
  4. dc3

List all nodes:

  1. $ consul catalog nodes
  2. Node ID Address DC
  3. worker-01 1b662d97 10.4.5.31 dc1

List all nodes which provide a particular service:

  1. $ consul catalog nodes -service=redis
  2. Node ID Address DC
  3. worker-01 1b662d97 10.4.5.31 dc1
  4. worker-02 d407a592 10.4.4.158 dc1

List all services:

  1. $ consul catalog services
  2. consul
  3. postgresql
  4. redis

List all services on a node:

  1. $ consul catalog services -node=worker-01
  2. consul
  3. postgres

For more examples, ask for subcommand help or view the subcommand documentation by clicking on one of the links in the sidebar.

Usage

Usage: consul catalog <subcommand>

For the exact documentation for your Consul version, run consul catalog -h to view the complete list of subcommands.

  1. Usage: consul catalog <subcommand> [options] [args]
  2. # ...
  3. Subcommands:
  4. datacenters Lists all known datacenters for this agent
  5. nodes Lists all nodes in the given datacenter
  6. services Lists all registered services in a datacenter

For more information, examples, and usage about a subcommand, click on the name of the subcommand in the sidebar or one of the links below: