📗
Everyday Cheat Sheets
  • README
  • Build
    • Architecture
      • API Management
        • Kong
      • Authentication
        • Keycloak
        • Okta
      • Cloud Native
      • Design Patterns
      • Design Principles
      • IaC
      • IoT
      • Message Broker
      • Methods
      • Networking
      • Payment
        • Stripe
      • Testing
    • Code lifecycle (ALM)
      • Automation Pipelines
        • Argo CD
        • CircleCI
        • Flux
        • Keptn
        • Travis
      • Azure DevOps
        • Azure Pipelines
      • Chef
      • GitHub
        • GitHub Actions
      • Nexus
      • Promyze
      • RunDeck
      • SaltStack
      • Sonar
      • Tuleap
    • Containers & Cloud Native
      • Argo Workflows
      • Containerization
        • Docker
          • Docker CLI
        • containerd
        • cri-o
      • CNAB
      • Dapr
      • Envoy
      • Fluentd
      • Knative
      • Kubernetes
        • Cluster API
        • etcd
        • Helm
        • k3d
        • kind
        • Kubectl
        • MetalLB
        • Minikube
      • Open Application Model (OAM)
      • Unleash
    • Data storage
      • MySQL
      • MongoDB
        • Atlas
        • Compass
        • Evergreen
        • MongoDB 4.2
        • MongoDB 5.0
        • MongoDB design
        • MongoDB events
        • MongoDB driver for .NET
        • Ops Manager
        • Realm
      • Oracle
      • Redis
      • SQL Server
      • PostgreSQL
    • Frameworks & libraries
      • Angular
        • Angular CLI
        • Angular events
      • .NET
        • ASP.NET Core
        • Blazor
        • .NET 5.0
        • .NET 6.0
        • .NET CLI
        • .NET Core
        • .NET Events
        • .NET Logging
        • .NET Testing
        • NuGet
        • WPF
        • Xamarin
      • gRPC
      • Ionic
      • Jekyll
      • Node.js
        • Express
        • NPM
      • React
        • React Native
      • Redux
    • IDE
      • Visual Studio 2022
    • Languages
      • C#
        • C# 8.0
      • ECMAScript
      • GraphQL
      • JavaScript
        • webpack
        • Yarn
      • MS-DOS
      • PHP
      • PowerShell
      • Python
      • Swagger
      • TypeScript
    • Messaging
      • Azure Service Bus
      • RabbitMQ
    • Testing
    • Workstation
      • QGIS
      • Visual Studio 2019
      • Windows 10
      • Windows Subsystem for Linux
  • Collaborate
    • Marp
    • Microsoft 365
      • Microsoft Graph
      • SharePoint Framework
        • Fluent UI
        • SharePoint Framework UI components
  • Run
    • Cloud computing
      • Alibaba
      • AWS
      • Azure
        • Azure AD
        • Azure CLI
        • Azure Container Registry
        • Azure Portal
        • Azure Service Bus
      • Firebase
      • OVH
    • Hardware
      • Single-board computers
        • Odroid
        • Raspberry Pi
    • Infrastructure automation
      • Azure Resource Manager
      • Packer
      • Pulumi
      • Puppet
      • Terraform
        • HCL
        • Terraform CLI
        • Terraform Providers
    • Networking
      • HAProxy
      • nginx
    • Observability
      • Grafana Labs
        • Grafana
        • Loki
        • Tempo
      • OpenTelemetry
      • Prometheus
      • Splunk
    • Security
      • Falco
    • Systems
      • Linux
        • CentOS
        • eBPF
        • Linux Kernel
        • Rocky
        • Ubuntu
      • Windows Server
    • Virtualization
      • Hyper-V
      • Vagrant
  • Optimize
    • DevOps
  • Join
    • Companies
      • HashiCorp
Powered by GitBook
On this page
  • Quick start
  • Installation
  • CLI
  • Learning
  • Recipes
  • Backup & restore

Was this helpful?

Export as PDF
  1. Build
  2. Containers & Cloud Native
  3. Kubernetes

etcd

PreviousCluster APINextHelm

Last updated 4 years ago

Was this helpful?

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

Reference: , , ,

Quick start

Installation

Several options:

  • Grab a pre-built binary from the

cd etcd-v3.4.12
etcd
  • Build from the source (written in Go)

# make sure Go is installed

# clone the repository
git clone https://github.com/etcd-io/etcd.git
cd etcd

# use the build script
./build
# In Windows we can't set the data directory (--mount type=bind,source=//d/ProgramData/etcd-data.tmp,destination=/etcd-data) because etcd checks folder permissions (700 versus 777), see https://github.com/etcd-io/etcd/blob/release-3.4/pkg/fileutil/fileutil.go

docker run -p 2379:2379 -p 2380:2380 --name etcd-gcr-v3.4.12 gcr.io/etcd-development/etcd:v3.4.12 /usr/local/bin/etcd --name s1 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster s1=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new --log-level info --logger zap --log-outputs stderr

docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcd --version"
docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcdctl version"
docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcdctl endpoint health"
docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcdctl put foo bar"
docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcdctl get foo"
docker exec etcd-gcr-v3.4.12 /bin/sh -c "/usr/local/bin/etcdctl del foo"

docker stop etcd-gcr-v3.4.12
docker rm etcd-gcr-v3.4.12

CLI

Command

Action

etcdctl member list

Lists all members in the cluster

Learning

Recipes

Backup & restore

# for Windows
SET ETCDCTL_API=3

# see https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/
etcdctl snapshot save etcd_snapshot.db
etcdctl --write-out=table snapshot status etcd_snapshot.db

# see https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/recovery.md#restoring-a-cluster
etcdctl snapshot restore etcd_snapshot.db --name m1 --initial-cluster m1=http://0.0.0.0:2380 --initial-cluster-token etcd-cluster-1 --initial-advertise-peer-urls http://0.0.0.0:2380 # will create m1.etcd folder
etcd --name m1 --data-dir m1.etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380

Docker (review latest version from )

etcd.io
GitHub
docs
API
releases page
releases page
Alibaba Cloud - Getting Started with Kubernetes | etcd