github.com/outbrain/consul@v1.4.5/website/source/docs/commands/catalog/nodes.html.md.erb (about) 1 --- 2 layout: "docs" 3 page_title: "Commands: Catalog List Nodes" 4 sidebar_current: "docs-commands-catalog-nodes" 5 --- 6 7 # Consul Catalog List Nodes 8 9 Command: `consul catalog nodes` 10 11 The `catalog nodes` command prints all known nodes and metadata about them. 12 It can also query for nodes that match a particular metadata or provide a 13 particular service. 14 15 ## Examples 16 17 List all nodes: 18 19 ```text 20 $ consul catalog nodes 21 Node ID Address DC 22 worker-01 1b662d97 10.4.5.31 dc1 23 ``` 24 25 Print detailed node information such as tagged addresses and node metadata: 26 27 ```text 28 $ consul catalog nodes -detailed 29 Node ID Address DC TaggedAddresses Meta 30 worker-01 1b662d97-8b5c-3cc2-0ac0-96f55ad423b5 10.4.5.31 dc1 lan=10.4.5.31, wan=10.4.5.31 31 ``` 32 33 List nodes which provide the service name "web": 34 35 ```text 36 $ consul catalog nodes -service=web 37 Node ID Address DC TaggedAddresses Meta 38 worker-01 1b662d97-8b5c-3cc2-0ac0-96f55ad423b5 10.4.5.31 dc1 lan=10.4.5.31, wan=10.4.5.31 39 ``` 40 41 Sort the resulting node list by estimated round trip time to worker-05: 42 43 ```text 44 $ consul catalog nodes -near=web-05 45 Node ID Address DC TaggedAddresses Meta 46 worker-01 1b662d97-8b5c-3cc2-0ac0-96f55ad423b5 10.4.5.31 dc1 lan=10.4.5.31, wan=10.4.5.31 47 worker-02 d407a592-e93c-4d8e-8a6d-aba853d1e067 10.4.4.158 dc1 lan=10.4.4.158, wan=10.4.4.158 48 ``` 49 50 ## Usage 51 52 Usage: `consul catalog nodes [options]` 53 54 #### API Options 55 56 <%= partial "docs/commands/http_api_options_client" %> 57 <%= partial "docs/commands/http_api_options_server" %> 58 59 #### Catalog List Nodes Options 60 61 - `-detailed` - Output detailed information about the nodes including their 62 addresses and metadata. 63 64 - `-near=<string>`- Node name to sort the node list in ascending order based on 65 estimated round-trip time from that node. Passing `"_agent"` will use this 66 agent's node for sorting. 67 68 - `-node-meta=<key=value>` - Metadata to filter nodes with the given key=value 69 pairs. This flag may be specified multiple times to filter on multiple sources 70 of metadata. 71 72 - `-service=<id or name>` - Service id or name to filter nodes. Only nodes 73 which are providing the given service will be returned.