01.03. Installation Etcd service on app-etcd

               <<< Back   Next >>>

https://computingforgeeks.com/how-to-install-etcd-on-rhel-centos-rocky-almalinux/

1. Installation etcd
[root]# 
ETCD_RELEASE=$(curl -s https://api.github.com/repos/etcd-io/etcd/releases/latest|grep tag_name | cut -d '"' -f 4)
echo $ETCD_RELEASE
wget https://github.com/etcd-io/etcd/releases/download/${ETCD_RELEASE}/etcd-${ETCD_RELEASE}-linux-amd64.tar.gz

tar xvf etcd-${ETCD_RELEASE}-linux-amd64.tar.gz
cd etcd-${ETCD_RELEASE}-linux-amd64
mv etcd* /usr/local/bin

2. Check version
[root]# 
etcd --version

3. Environment
[root]# 
mkdir -p /var/lib/etcd/
mkdir /etc/etcd
groupadd --system etcd
useradd -s /sbin/nologin --system -g etcd etcd
chown -R etcd:etcd /var/lib/etcd/
chmod 0775 /var/lib/etcd/

4. Create service
[root]# vi /etc/systemd/system/etcd.service
[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

5. Change configuration
[root]# vi /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd"
ETCD_LISTEN_PEER_URLS="http://0.0.0.0:2380"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_NAME="default"
ETCD_HEARTBEAT_INTERVAL="1000"
ETCD_ELECTION_TIMEOUT="5000"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.1.85:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.85:2379"
ETCD_INITIAL_CLUSTER="default=http://192.168.1.85:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"

6. Startup service and check
[root]# 
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
systemctl status etcd -l

7. Additional commands
[root]# etcdctl set /message "Hello World"
Hello World
[root]# etcdctl get /message
Hello World

[root]# etcdctl cluster-health
member a67a46e7ef0c58e0 is healthy: got healthy result from http://192.168.1.65:2379
cluster is healthy



               <<< Back   Next >>>

No comments:

Post a Comment