User-defined Playground

etcd store Playground

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

etcd store playground: A distributed, reliable key-value store for the most critical data of a distributed system.
Machines & network
1 VM ยท 4 vCPU ยท 8GiB RAM
Playground host Internet NAT MASQUERADE local (bridge) 172.16.0.0/24 gw 172.16.0.1/24eth0
VM
vCPU ยท
eth0
/
oci://ghcr.io/sagikazarmark/iximiuz-labs/playgrounds/etcd:live@sha256:75e2ad439ef4aa86c7d035c95272aa3cc9b5d59562a1e23f1dbf1082ce43fc07
About

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.

Note

๐Ÿ’ก 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
Important

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! ๐Ÿš€

Every playground includes
Learn more about playgrounds
Start
Settings