Skip to main content
In this section, we reviewed the essential steps to install, configure, and operate Consul agents in both server and client modes.

Key Takeaways

Before restarting agents, validate your configuration:

1. Starting and Managing the Consul Process

You can start a Consul agent directly from the command line:
Or use an HCL/JSON configuration file (consul.hcl):

2. Interpreting Consul Agent Configurations

Both HCL and JSON support the same agent options.
Example HCL for a client agent registering a web service:

3. Configuring Network Addresses and Ports

Fine-tune Consul network settings to optimize performance and security:
  • bind_addr: IP/interface for RPC, HTTP, DNS
  • advertise_addr: Publicly advertised address
  • ports.rpc, ports.http, ports.dns

4. Agent Join and Leave Behaviors

Joining a Cluster

Use the consul join command to add a new node:

Graceful Leave

For clients and especially servers, remove nodes gracefully to maintain cluster health:
Always drain and remove server nodes gracefully to avoid quorum loss.
Use consul leave rather than killing the process.

Next Steps

Move on to Objective 3: Service Discovery & Health Checking to learn how Consul automatically tracks and verifies service health.

Watch Video