Howtodojo logo
  • Home 
  • About 
  • Certifications 
  • Sample Database 
  • Cheatsheet 
  • Glossary 
  • Blog 
  • Tags 
  1.   Cheatsheet
  1. Home
  2. Cheatsheet
  3. Consul Cheat Sheet

Consul Cheat Sheet

Share via
Howtodojo
Link copied to clipboard

Welcome to the Consul Cheat Sheet, your quick reference guide for essential commands and operations in HashiCorp Consult

On this page
Introduction   How to Use   Cheat Sheet  

Introduction  

Welcome to the Consul Cheat Sheet, your quick reference guide for essential commands and operations in HashiCorp Consul. Consul is a powerful tool for service discovery, key-value store management, and network infrastructure automation. Whether you are a beginner exploring the basics or an experienced user in need of a quick reminder, this cheat sheet provides a concise overview of key Consul commands in a convenient table format.

How to Use  

Each entry in this cheat sheet presents a specific Consul command along with a brief description of its purpose. The commands cover a range of functionalities, including starting a Consul agent, interacting with the key-value store, managing ACLs, monitoring the cluster, and utilizing Connect for service mesh capabilities.

Feel free to customize and expand upon these commands based on your specific requirements and use cases. Whether you are working with a single-node development setup or a production-scale Consul cluster, this cheat sheet serves as a handy reference to streamline your interactions with Consul.

Cheat Sheet  

No. Command Description
1 consul agent -dev Start a local development Consul agent
2 consul agent -server -bootstrap-expect=1 Start a single-node Consul server in bootstrap mode
3 consul members List members of the Consul cluster
4 consul info Display information about the Consul agent
5 consul catalog services List services registered with the Consul catalog
6 consul kv put key1 value1 Put a key-value pair into the Consul key-value store
7 consul kv get key1 Retrieve the value of a key from the key-value store
8 consul kv delete key1 Delete a key from the Consul key-value store
9 consul monitor Monitor Consul logs in real-time
10 consul leave Gracefully leave the Consul cluster
11 consul reload Trigger a configuration reload of the Consul agent
12 consul members -detailed Display detailed information about Consul members
13 consul status leader Show the current Consul leader
14 consul watch -type=key -key=key1 Watch a key in the Consul key-value store
15 consul event -name=my-event Fire a custom event in the Consul cluster
16 consul lock my-key my-command Acquire a lock on a key for executing a command
17 consul lock -name=my-lock my-command Acquire a named lock for executing a command
18 consul acl policy list List ACL policies in Consul
19 consul acl role create -name=my-role Create a new ACL role in Consul
20 consul acl token create -description=my-token Create a new ACL token in Consul
21 consul acl binding rule -method=GET Create an ACL binding rule for HTTP method
22 consul operator raft list-peers List Raft peers in the Consul cluster
23 consul snapshot save snapshot.snap Create a snapshot of the Consul server state
24 consul operator autopilot health Check the health of the Autopilot subsystem
25 consul connect envoy -sidecar-for=web Generate Envoy sidecar configuration for a service
26 consul connect proxy -service=web Launch a proxy for a service in Connect
27 consul connect intentions -http List HTTP intentions in Consul Connect
28 consul catalog nodes -service=web List nodes providing a specific service
29 consul kv export > backup.json Export the entire key-value store to a JSON file
30 consul acl bootstrap Bootstrap ACLs on a new Consul server
31 consul connect intentions create -deny Create a deny intention in Consul Connect
32 consul catalog services -tags=production List services with specific tags in the Consul catalog
33 consul kv put -cas=0 key2 value2 Put a key-value pair without check-and-set (CAS)
34 consul kv get -recurse key Recursively retrieve all key-value pairs under a key
35 consul monitor -log-level=debug Monitor Consul logs with debug log level
36 consul operator keyring use -keyring=my-keyring Use a specific keyring for operator-related commands
37 consul config write config.hcl Write a configuration file for Consul
38 consul connect proxy -sidecar-for=web Launch a proxy sidecar for a service in Connect
39 consul agent -config-file=my-config.json Start Consul agent with a specific configuration file
40 consul reload -rpc-addr=127.0.0.1:8400 Trigger a configuration reload on a specific RPC address
41 consul operator keyring export -keyring=my-keyring Export a keyring for backup or sharing
42 consul catalog services -health List services with health checks in the Consul catalog
43 consul connect inject -sidecar-for=web Inject Connect proxy configuration into a service
44 consul acl token update -id=my-token -name=new-name Update the name of an ACL token
45 consul kv put -flags=42 key3 value3 Put a key-value pair with a custom numeric flag
46 consul agent -retry-join=consul-server-1 Join a specific Consul server using retry-join
47 consul config write -kind=service my-service.hcl Write a service-specific configuration file
48 consul snapshot restore snapshot.snap Restore Consul server state from a snapshot
49 consul connect intentions delete -id=my-intention Delete a specific intention in Consul Connect
50 consul version Display the version of Consul
On this page:
Introduction   How to Use   Cheat Sheet  
Follow me

We publish tutorials, tips and tricks about Linux, open source, cloud computing, and infrastructure

     
Copyright © 2012 - 2025 howtodojo.com. |
Howtodojo
Code copied to clipboard