etcd


etd

Overview

etcd is a distributed, reliable key‑value store used by many distributed systems (e.g., Kubernetes, Cloud services). It provides consistency across nodes and fault tolerance.

1. Running a Single Node

You can start a single-node cluster with the simplest command:

etcd

This creates a local instance that listens on default ports.

2. Custom URL for Client Requests

To customize client communication, use the --advertise-client-urls and --listen-client-urls options:

etcd --advertise-client-urls http://127.0.0.1:1234 --listen-client-urls http://127.0.0.1:1234

The client will connect to the specified URL, and the server listens on that URL.

3. Custom Name

Assign a unique name to your cluster:

etcd --name my_etcd_cluster

This helps distinguish clusters in multi‑node setups.

4. Enable Metrics and Debugging

Enable performance metrics and debugging via --enable-pprof:

etcd --enable-pprof --metrics extensive

The server exposes a debug page at http://localhost:2379/debug/pprof/, allowing you to inspect runtime statistics.

Common Pitfalls

  • Port Conflict – Ensure ports are free; default listen is 2380, advertise is 2381. If both are used on the same port, it may fail.

  • Client URL mismatch – Client must connect to the advertised URL; otherwise communication fails.

  • Cluster Name Conflicts – In multi‑node setups, identical names can lead to confusion or collision.

Quick Example

etcd --advertise-client-urls http://127.0.0.1:1234 --listen-client-urls http://127.0.0.1:1234 --name my_etcd_cluster --enable-pprof --metrics extensive

Running this command creates a single node with custom URL, name, and debug metrics.


See Also