| Command / Tip | Description | Documentation |
|---|---|---|
consul agent -dev |
Start Consul in development mode. | Consul Agent |
consul members |
List the members of a Consul cluster. | Consul Members |
consul join <address> |
Join a node to a Consul cluster. | Consul Join |
consul catalog services |
List all services registered with the Consul cluster. | Catalog Services |
consul catalog nodes -service=<name> |
List nodes associated with a given service. | Catalog Nodes for Service |
consul kv put <key> <value> |
Add or update a key-value pair. | KV Put |
consul kv get <key> |
Retrieve the value of a key. | KV Get |
consul watch -type=<type> <parameters> |
Watch for changes in Consul's state. | Consul Watch |
consul snapshot save <file> |
Take a snapshot of the Consul server state. | Snapshot Save |
consul snapshot restore <file> |
Restore a Consul server state from a snapshot. | Snapshot Restore |
consul acl bootstrap |
Bootstrap ACLs. Generates a management token. | ACL Bootstrap |
consul acl policy create -name <name> -rules <rules> |
Create an ACL policy. | ACL Policy Create |
consul acl token create -description <desc> -policy-name <name> |
Create an ACL token with the specified policy. | ACL Token Create |
| Tip: Secure Consul | Always enable ACLs for production environments to control access. | ACL Guide |
| Tip: Use Consul Connect | For secure service-to-service communication, utilize Consul Connect. | Consul Connect |
| Tip: Datacenter Federation | Use federation to enable service discovery and configurations across multiple Consul datacenters. | Federation Guide |
| Tip: Monitoring and Metrics | Leverage Consul's telemetry features for monitoring and performance metrics. | Monitoring Consul |
| Tip: Disaster Recovery | Regularly back up your Consul state and familiarize yourself with restore procedures. | Disaster Recovery |
| Tip: Consul Template | Use Consul Template for dynamic updates to configurations based on Consul's state. | Consul Template |
| Tip: Service Mesh Configurations | Define service protocols in service definitions for L7 features in Consul Connect. | Service Configuration |
This cheat sheet covers foundational commands and practices for working with Consul. For a more comprehensive guide and advanced topics, refer to the official Consul Documentation.