open-consul/website/pages/commands/catalog/index.mdx
Jasmine W 8ae3332165
docs: update structure (#8506)
- moved and renamed files/folders based on new structure
- updated docs navigation based on new structure
- moved CLI to top nav (created commands.jsx and commands-navigation.js)
- updated and added redirects
- updating to be consistent with standalone categories
- changing "overview" link in top nav to lead to where intro was moved (docs/intro)
- adding redirects for intro content
- deleting old intro folders
- format all data/navigation files
- deleting old commands folder
- reverting changes to glossary page
- adjust intro navigation for removal of 'vs' paths
- add helm page redirect
- fix more redirects
- add a missing redirect
- fix broken anchor links and formatting mistakes
- deleted duplicate section, added redirect, changed link
- removed duplicate glossary page
2020-09-01 11:14:13 -04:00

85 lines
1.7 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Catalog'
sidebar_title: catalog
---
# Consul 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](/api/catalog).
## Basic Examples
List all datacenters:
```shell-session
$ consul catalog datacenters
dc1
dc2
dc3
```
List all nodes:
```shell-session
$ consul catalog nodes
Node ID Address DC
worker-01 1b662d97 10.4.5.31 dc1
```
List all nodes which provide a particular service:
```shell-session
$ consul catalog nodes -service=redis
Node ID Address DC
worker-01 1b662d97 10.4.5.31 dc1
worker-02 d407a592 10.4.4.158 dc1
```
List all services:
```shell-session
$ consul catalog services
consul
postgresql
redis
```
List all services on a node:
```shell-session
$ consul catalog services -node=worker-01
consul
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.
```text
Usage: consul catalog <subcommand> [options] [args]
# ...
Subcommands:
datacenters Lists all known datacenters for this agent
nodes Lists all nodes in the given datacenter
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: