We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

48
1.843.106,50

Cart

Quantity 17.380,80
Quantity 140.100,00
Quantity 1.125,00
Quantity 58.729,05

Learn how to – How to Install etcd on Ubuntu 22.04|20.04|18.04|16.04

Learn how to – How to Install etcd on Ubuntu 22.04|20.04|18.04|16.04.

Etcd is a simple, reliable, fast and secure open source key-value store written in Go. It uses the Raft consensus algorithm to manage a highly-available replicated log. In this guide, we will install a single node (one member) etcd on Ubuntu 22.04|20.04|18.04|16.04.

Note: This is a single node cluster setup, for three node cluster, refer to the guide below.

Install etcd on Ubuntu 22.04|20.04|18.04|16.04

Etcd is distributed as a binary package though you can build it from source. In this guide, we’re going to download a pre-built binary package.

Check the pre-built release binaries before you proceed to get the latest release tag. Install curl and wget packages on your Ubuntu system

sudo apt update
sudo apt install vim wget curl

Download the latest release of etcd on Ubuntu:

export RELEASE=$(curl -s https://api.github.com/repos/etcd-io/etcd/releases/latest|grep tag_name | cut -d '"' -f 4)
wget https://github.com/etcd-io/etcd/releases/download/${RELEASE}/etcd-${RELEASE}-linux-amd64.tar.gz

Extract downloaded archive file.

tar xvf etcd-${RELEASE}-linux-amd64.tar.gz

Change to new file directory

cd etcd-${RELEASE}-linux-amd64

Move etcd and etcdctl binary files to /usr/local/bin directory.

sudo mv etcd etcdctl etcdutl /usr/local/bin 

Confirm version:

$ etcd --version
etcd Version: 3.5.2
Git SHA: 99018a77b
Go Version: go1.16.3
Go OS/Arch: linux/amd64

$ etcdctl version
etcdctl version: 3.5.2
API version: 3.5

$ etcdutl version
etcdutl version: 3.5.2
API version: 3.5

Create Etcd configuration file and data directory.

sudo mkdir -p /var/lib/etcd/
sudo mkdir /etc/etcd

Create etcd system user

sudo groupadd --system etcd
sudo useradd -s /sbin/nologin --system -g etcd etcd

Set /var/lib/etcd/ directory ownership to etcd user.

sudo chown -R etcd:etcd /var/lib/etcd/

Configure Systemd and start etcd service

Create a new systemd service file for etcd.

 sudo vim /etc/systemd/system/etcd.service

Paste below data into the file.

[Unit]
Description=etcd key-value store
Documentation=https://github.com/etcd-io/etcd
After=network.target

[Service]
User=etcd
Type=notify
Environment=ETCD_DATA_DIR=/var/lib/etcd
Environment=ETCD_NAME=%m
ExecStart=/usr/local/bin/etcd
Restart=always
RestartSec=10s
LimitNOFILE=40000

[Install]
WantedBy=multi-user.target

Reload systemd service and start etcd on Ubuntu 18,04 / Ubuntu 16,04

sudo systemctl  daemon-reload
sudo systemctl start etcd.service

Enable the service to start at system boot:

$ sudo systemctl enable etcd.service
Created symlink /etc/systemd/system/multi-user.target.wants/etcd.service → /etc/systemd/system/etcd.service.

Check service status:

$ systemctl status etcd.service
● etcd.service - etcd key-value store
     Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-02-04 07:40:01 UTC; 46s ago
       Docs: https://github.com/etcd-io/etcd
   Main PID: 63132 (etcd)
      Tasks: 7 (limit: 4677)
     Memory: 6.9M
     CGroup: /system.slice/etcd.service
             └─63132 /usr/local/bin/etcd

Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.132Z","caller":"etcdserver/server.go:2031","msg":"published local member to cluster through raft","local-mem>
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.132Z","caller":"etcdserver/server.go:2480","msg":"setting up initial cluster version using v2 API","cluster->
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.132Z","caller":"embed/serve.go:98","msg":"ready to serve client requests"}
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.133Z","caller":"membership/cluster.go:584","msg":"set initial cluster version","cluster-id":"cdf818194e3a8c3>
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.133Z","caller":"api/capability.go:75","msg":"enabled capabilities for version","cluster-version":"3.5"}
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.133Z","caller":"etcdserver/server.go:2504","msg":"cluster version is updated","cluster-version":"3.5"}
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.133Z","caller":"embed/serve.go:140","msg":"serving client traffic insecurely; this is strongly discouraged!">
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.134Z","caller":"etcdmain/main.go:47","msg":"notifying init daemon"}
Feb 04 07:40:01 ubuntu-20-04-01 etcd[63132]: {"level":"info","ts":"2022-02-04T07:40:01.134Z","caller":"etcdmain/main.go:53","msg":"successfully notified init daemon"}
Feb 04 07:40:01 ubuntu-20-04-01 systemd[1]: Started etcd key-value store.

The service will start on localhost address port 2379

$ ss -tunelp | grep 2379
 tcp   LISTEN 0 128 127.0.0.1:2379 0.0.0.0:*  uid:998 ino:72981 sk:45c <-> 

$ etcdctl member list
 8e9e05c52164694d: name=5fbf3d068d6c491eb687a7a427fc2263 peerURLs=http://localhost:2380 clientURLs=http://localhost:2379 isLeader=true

Checking health status:

$ etcdctl  endpoint health
127.0.0.1:2379 is healthy: successfully committed proposal: took = 1.871483ms

In our next tutorial, I’ll cover setting up Etcd cluster on Ubuntu Linux system.

Related: How to Install etcd on RHEL / CentOS 8

48
1.843.106,50

Cart

Quantity 17.380,80
Quantity 140.100,00
Quantity 1.125,00
Quantity 58.729,05