LinuxCommandLibrary

consul

Manage service discovery and configuration

TLDR

Display help

$ consul --help
copy

Display help for a subcommand
$ consul [subcommand] --help
copy

Display version
$ consul --version
copy

SYNOPSIS

consul [global-options] <subcommand> [<subcommand-options>]

PARAMETERS

-bind=<addr>
    Address/interface to bind for internal cluster communication (default: first private IP)

-bootstrap-expect=<num>
    Minimum servers to form quorum before bootstrapping

-client-addr=<addr>
    Address for incoming client, DNS, HTTP traffic (default: 127.0.0.1)

-config-dir=<dir>
    Directory to search for configuration files (default: /etc/consul.d)

-config-file=<file>
    Path to specific configuration file (can specify multiple)

-data-dir=<dir>
    Directory for data storage (e.g., snapshots, Raft logs)

-dev
    Enable development mode: single-node, in-memory, UI enabled

-dns-port=<port>
    Port for DNS server (default: 8600)

-http-addr=<addr>
    Address for HTTP API (default: client-addr:8500)

-log-level=<level>
    Log verbosity: trace, debug, info, warn, err (default: info)

-node=<name>
    Name of this node (default: hostname)

-retry-join=<addr...>
    Addresses of servers to attempt joining (repeatable)

-retry-max=<num>
    Maximum join retries (default: 0, infinite)

-server
    Run as Consul server (stores full state)

-ui
    Enable web UI server

-ui-dir=<dir>
    Directory for web UI assets

DESCRIPTION

Consul is an open-source infrastructure automation tool developed by HashiCorp for service discovery, configuration management, and service mesh capabilities in distributed environments.

It enables dynamic service registration and discovery, health monitoring, key/value storage, and secure service communication. Consul uses a gossip protocol (via Serf) for failure detection and a Raft consensus for leader election among servers.

Deployed as agents on nodes (server or client mode), Consul servers store cluster state while clients forward queries. It supports multi-datacenter federation, DNS and HTTP APIs for querying services, intentions for authorization, and Connect for sidecar proxies (Envoy-based service mesh).

Common use cases include microservices orchestration, zero-trust networking, and configuration distribution across clouds or on-premises. Consul integrates with tools like Terraform, Vault, and Nomad. Production setups typically use 3-5 servers for quorum.

CAVEATS

Not a standard Linux utility; install via HashiCorp repos or packages. High resource use in production (servers need stable storage/network). Global flags apply to all subcommands; subcommands have additional options.

COMMON SUBCOMMANDS

agent: Run Consul agent.
members: List cluster members.
services: List/register services.
kv: Key/value store operations.
operator: Debug/raft tools.
join: Join cluster.
Use consul <subcommand> --help for details.

DEPLOYMENT NOTES

Run servers with -server -bootstrap-expect=3; clients with -retry-join. Enable ACLs in production for security. UI at http://localhost:8500 by default.

HISTORY

Released by HashiCorp in October 2014 under MPL 2.0 license. Evolved from early versions with Serf integration; v1.0 (2018) stabilized APIs; later added Consul Connect (service mesh) and multi-architecture support. Actively maintained with quarterly releases.

SEE ALSO

dig(1), curl(1), systemctl(1), envoy(8)

Copied to clipboard