User-defined Playground

etcd store Playground

A distributed, reliable key-value store for the most critical data of a distributed system.

Startup configuration
etcd
etcd store playground: A distributed, reliable key-value store for the most critical data of a distributed system.

This environment is set up for learning how to work with etcd — a distributed, reliable key-value store for the most critical data of a distributed system, used by Kubernetes and many other cloud-native applications.

💡 This is a single-node playground for etcd. To explore clustering capabilities, try the multi-node playground.

🔧 System Components

  • etcd: The distributed key-value store daemon.

🛠️ Tools

  • etcdctl: The official command-line client for etcd.
  • etcdutl: Utility for etcd database operations and maintenance.

🎯 Getting Started

Basic Operations

# Check etcd status
etcdctl version
etcdctl endpoint health

# Put and get values
etcdctl put mykey "Hello World"
etcdctl get mykey

# List all keys
etcdctl get --prefix ""

Working with Prefixes

# Put multiple keys with a common prefix
etcdctl put /app/config/db-host "localhost"
etcdctl put /app/config/db-port "5432"

# Get all keys with prefix
etcdctl get --prefix /app/config/

Watch for Changes

# Watch a specific key
etcdctl watch mykey

# Watch all keys with prefix
etcdctl watch --prefix /app/

⚙️ Configuration

There are multiple ways to configure etcd.

Hint 💡

Make sure to always restart the service after making changes:

sudo systemctl restart etcd

Environment Variables

Configure environment variables in /etc/default/etcd:

sudoedit /etc/default/etcd

Configuration File

Uncomment the following line in /etc/default/etcd:

ETCD_CONFIG_FILE=/etc/etcd/config.yaml

Then edit the configuration file:

sudoedit /etc/etcd/config.yaml

Service Configuration

Use systemd override for advanced configuration:

sudo systemctl edit etcd

Example override configuration:

[Service]
ExecStart=
ExecStart=/usr/bin/etcd --data-dir=/var/lib/etcd --listen-client-urls=http://0.0.0.0:2379

The empty ExecStart= is important, otherwise systemd will attempt to run two instances of etcd.

After editing, reload and restart the service:

sudo systemctl daemon-reload
sudo systemctl restart etcd

📚 Learn More

🧪 Playgrounds

Happy learning! 🚀

Start
Settings