Command |
Description |
consul agent |
Starts a Consul agent with default configuration. |
consul agent -dev |
Starts a development mode Consul agent, useful for local testing. |
consul agent -config-file= |
Starts a Consul agent with the provided configuration file. |
consul agent -data-dir= |
Specifies the data directory for the Consul agent. |
consul agent -enable-script-checks |
Enables script-based health checks. |
consul agent -join= |
Specifies an address to join an existing Consul cluster. |
consul agent -node= |
Specifies the node name for the Consul agent. |
consul agent -bootstrap-expect= |
Specifies the number of server nodes to expect when bootstrapping a new cluster. |
consul agent -ui |
Starts the Consul agent with the UI enabled. |
Command |
Description |
consul catalog datacenters |
Lists the datacenters known to the Consul agent. |
consul catalog nodes |
Lists the nodes in the Consul cluster. |
consul catalog services |
Lists the services registered in the Consul cluster. |
consul catalog service |
Lists the nodes providing a specific service. |
consul catalog node |
Retrieves information about a specific node. |
consul catalog service -tag= |
Lists the nodes providing a specific service with a given tag. |
consul catalog connect -service= |
Retrieves the connection information for a service. |
consul catalog connect -service= -tag= |
Retrieves the connection information for a service with a given tag. |
Command |
Description |
consul kv put |
Sets the value of a key in the key-value store. |
consul kv get |
Retrieves the value of a key from the key-value store. |
consul kv delete |
Deletes a key from the key-value store. |
consul kv list |
Lists all keys with a given prefix from the key-value store. |
consul kv export |
Exports all key-value pairs from the key-value store. |
consul kv import |
Imports key-value pairs from a file into the key-value store. |
consul kv get -recurse |
Retrieves all keys and values from the key-value store. |
consul kv delete -recurse |
Deletes all keys and values from the key-value store. |
Command |
Description |
consul services register |
Registers a new service with Consul using the provided configuration. |
consul services deregister |
Deregisters a service from Consul using its ID. |
consul services list |
Lists all services registered with Consul. |
consul services list -service= |
Lists all instances of a specific service. |
consul services health |
Provides the health status of all services. |
consul services health -service= |
Provides the health status of a specific service. |
consul services maintenance -enable |
Puts a service into maintenance mode. |
consul services maintenance -disable |
Takes a service out of maintenance mode. |
Command |
Description |
consul acl bootstrap |
Generates the initial ACL tokens and policy for Consul. |
consul acl policy create |
Creates a new ACL policy with the given name and policy file. |
consul acl policy read |
Reads the details of a specific ACL policy. |
consul acl policy update |
Updates an existing ACL policy with the given name and policy file. |
Command |
Description |
consul maintenance enable -reason= |
Puts the Consul agent into maintenance mode with a specific reason. |
consul maintenance disable |
Takes the Consul agent out of maintenance mode. |
consul maintenance status |
Checks the maintenance status of the Consul agent. |
Command |
Description |
consul event fire |
Fires a custom event with the given name. |
consul event list |
Lists all the events in the cluster. |
consul event list -name= |
Lists all the instances of a specific event. |
consul event fire -node= |
Fires a custom event on a specific node. |
consul event fire -service= |
Fires a custom event on all instances of a specific service. |
Command |
Description |
consul-template -consul-addr= -template=: |
Renders a template file using Consul data and writes the output to a file. |
consul-template -consul-addr= -template=: |
Renders a template file using Consul data and executes a command with the output. |
consul-template -consul-addr= -template=: |
Renders a template file using Consul data and passes the output as arguments to a command. |
consul-template -config= |
Starts Consul Template using the provided configuration file. |
Command |
Description |
consul check list |
Lists all health checks in the cluster. |
consul check register |
Registers a new health check using the provided check definition file. |
consul check deregister |
Deregisters a health check using its ID. |
consul check ttl |
Updates the status of a TTL-based health check. |
consul check ttl |
Updates the status of a TTL-based health check with a note. |
consul check http |
Registers an HTTP health check with the provided URL and interval. |
consul check tcp |
Registers a TCP health check with the provided address and interval. |
consul check script |
Registers a script-based health check with the provided script file and interval. |
consul check http -header= |
Registers an HTTP health check with a custom header. |
This cheat sheet provides a comprehensive list of commands for different aspects of HashiCorp Consul administration, including agent management, catalog management, key-value operations, service registration, ACL management, query execution, snapshot handling, network configuration, maintenance mode, event handling, Consul Template usage, health checking, and more.