2017-07-14 15:45:08 -04:00
|
|
|
---
|
2020-09-01 10:14:13 -05:00
|
|
|
layout: commands
|
2020-04-07 14:55:19 -04:00
|
|
|
page_title: 'Commands: Catalog List Services'
|
2017-07-14 15:45:08 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Catalog List Services
|
|
|
|
|
|
|
|
Command: `consul catalog services`
|
|
|
|
|
2022-01-11 08:26:58 -05:00
|
|
|
Corresponding HTTP API Endpoint: [\[GET\] /v1/catalog/services](/api-docs/catalog#list-services)
|
2022-01-10 12:40:11 -05:00
|
|
|
|
2017-07-14 15:45:08 -04:00
|
|
|
The `catalog services` command prints all known services. It can also query
|
|
|
|
for services that match particular metadata or list the services that a
|
|
|
|
particular node provides.
|
|
|
|
|
2022-01-10 16:44:56 -05:00
|
|
|
The table below shows this command's [required ACLs](/api#authentication). Configuration of
|
|
|
|
[blocking queries](/api/features/blocking) and [agent caching](/api/features/caching)
|
|
|
|
are not supported from commands, but may be from the corresponding HTTP endpoint.
|
|
|
|
|
|
|
|
| ACL Required |
|
|
|
|
| -------------- |
|
|
|
|
| `service:read` |
|
|
|
|
|
2017-07-14 15:45:08 -04:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
List all services:
|
|
|
|
|
2020-05-19 14:32:38 -04:00
|
|
|
```shell-session
|
2017-07-14 15:45:08 -04:00
|
|
|
$ consul catalog services
|
|
|
|
consul
|
|
|
|
postgresql
|
|
|
|
redis
|
|
|
|
```
|
|
|
|
|
|
|
|
Show all services with their tags:
|
|
|
|
|
2020-05-19 14:32:38 -04:00
|
|
|
```shell-session
|
2017-07-14 15:45:08 -04:00
|
|
|
$ consul catalog services -tags
|
|
|
|
consul
|
|
|
|
postgresql leader
|
|
|
|
redis primary,v1
|
|
|
|
```
|
|
|
|
|
|
|
|
List services for the node "worker-01":
|
|
|
|
|
2020-05-19 14:32:38 -04:00
|
|
|
```shell-session
|
2017-07-14 15:45:08 -04:00
|
|
|
$ consul catalog services -node=worker-01
|
|
|
|
consul
|
|
|
|
redis
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul catalog services [options]`
|
|
|
|
|
|
|
|
#### API Options
|
|
|
|
|
2020-04-07 14:55:19 -04:00
|
|
|
@include 'http_api_options_client.mdx'
|
2020-04-07 19:56:08 -04:00
|
|
|
|
2020-04-07 14:55:19 -04:00
|
|
|
@include 'http_api_options_server.mdx'
|
2017-07-14 15:45:08 -04:00
|
|
|
|
2019-12-09 21:26:41 -05:00
|
|
|
#### Enterprise Options
|
|
|
|
|
2020-04-07 14:55:19 -04:00
|
|
|
@include 'http_api_namespace_options.mdx'
|
2019-12-09 21:26:41 -05:00
|
|
|
|
2021-12-14 17:55:21 -08:00
|
|
|
@include 'http_api_partition_options.mdx'
|
|
|
|
|
2017-07-14 15:45:08 -04:00
|
|
|
#### Catalog List Nodes Options
|
|
|
|
|
|
|
|
- `-node=<id or name>` - Node `id or name` for which to list services.
|
|
|
|
|
|
|
|
- `-node-meta=<key=value>` - Metadata to filter nodes with the given
|
|
|
|
`key=value` pairs. If specified, only services running on nodes matching the
|
|
|
|
given metadata will be returned. This flag may be specified multiple times to
|
|
|
|
filter on multiple sources of metadata.
|
|
|
|
|
|
|
|
- `-tags` - Display each service's tags as a comma-separated list beside each
|
|
|
|
service entry.
|