github.com/outbrain/consul@v1.4.5/website/source/docs/commands/catalog.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands: Catalog"
     4  sidebar_current: "docs-commands-catalog"
     5  ---
     6  
     7  # Consul Catalog
     8  
     9  Command: `consul catalog`
    10  
    11  The `catalog` command is used to interact with Consul's catalog via the command
    12  line. It exposes top-level commands for reading and filtering data from the
    13  registry.
    14  
    15  The catalog is also accessible via the [HTTP API](/api/catalog.html).
    16  
    17  ## Basic Examples
    18  
    19  List all datacenters:
    20  
    21  ```text
    22  $ consul catalog datacenters
    23  dc1
    24  dc2
    25  dc3
    26  ```
    27  
    28  List all nodes:
    29  
    30  ```text
    31  $ consul catalog nodes
    32  Node       ID        Address    DC
    33  worker-01  1b662d97  10.4.5.31  dc1
    34  ```
    35  
    36  List all nodes which provide a particular service:
    37  
    38  ```text
    39  $ consul catalog nodes -service=redis
    40  Node       ID        Address     DC
    41  worker-01  1b662d97  10.4.5.31   dc1
    42  worker-02  d407a592  10.4.4.158  dc1
    43  ```
    44  
    45  List all services:
    46  
    47  ```text
    48  $ consul catalog services
    49  consul
    50  postgresql
    51  redis
    52  ```
    53  
    54  List all services on a node:
    55  
    56  ```text
    57  $ consul catalog services -node=worker-01
    58  consul
    59  postgres
    60  ```
    61  
    62  For more examples, ask for subcommand help or view the subcommand documentation
    63  by clicking on one of the links in the sidebar.
    64  
    65  ## Usage
    66  
    67  Usage: `consul catalog <subcommand>`
    68  
    69  For the exact documentation for your Consul version, run `consul catalog -h` to
    70  view the complete list of subcommands.
    71  
    72  ```text
    73  Usage: consul catalog <subcommand> [options] [args]
    74  
    75    # ...
    76  
    77  Subcommands:
    78      datacenters    Lists all known datacenters for this agent
    79      nodes          Lists all nodes in the given datacenter
    80      services       Lists all registered services in a datacenter
    81  ```
    82  
    83  For more information, examples, and usage about a subcommand, click on the name
    84  of the subcommand in the sidebar or one of the links below: