In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to install and configure ETCD". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and configure ETCD.
Master: 192.168.56.101
Worker node1: 192.168.56.102
Worker node2: 192.168.56.103
Before installing K8s, manually install and configure etcd to download etcd
Https://github.com/etcd-io/etcd/releases/download/v3.2.30/etcd-v3.2.30-linux-amd64.tar.gz
Transfer to 3 nodes and decompress the package
Mkdir / opt/etcd/ {bin,cfg,ssl}-p
Tar-zxvf etcd-v3.2.30-linux-amd64.tar.gz-C. /
Mv etcd-v3.2.30-linux-amd64/ {etcd,etcdctl} / opt/etcd/bin/ master Node profile / opt/etcd/cfg/etcd
# [Member]
ETCD_NAME= "etcd-1"
ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS= "https://192.168.56.101:2380"
ETCD_LISTEN_CLIENT_URLS= "https://192.168.56.101:2379"
# [Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS= "https://192.168.56.101:2380"
ETCD_ADVERTISE_CLIENT_URLS= "https://192.168.56.101:2379"
ETCD_INITIAL_CLUSTER= "etcd-1= https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE= "new" Worker node1 Node profile / opt/etcd/cfg/etcd
# [Member]
ETCD_NAME= "etcd-2"
ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS= "https://192.168.56.102:2380"
ETCD_LISTEN_CLIENT_URLS= "https://192.168.56.102:2379"
# [Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS= "https://192.168.56.102:2380"
ETCD_ADVERTISE_CLIENT_URLS= "https://192.168.56.102:2379"
ETCD_INITIAL_CLUSTER= "etcd-1= https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE= "new" Worker node2 Node profile / opt/etcd/cfg/etcd
# [Member]
ETCD_NAME= "etcd-3"
ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS= "https://192.168.56.103:2380"
ETCD_LISTEN_CLIENT_URLS= "https://192.168.56.103:2379"
# [Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS= "https://192.168.56.103:2380"
ETCD_ADVERTISE_CLIENT_URLS= "https://192.168.56.103:2379"
ETCD_INITIAL_CLUSTER= "etcd-1= https://192.168.56.101:2380,etcd-2=https://192.168.56.102:2380,etcd-3=https://192.168.56.103:2380"
ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE= "new" master node, Worker node1, Worker node2 configuration file / usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd
ExecStart=/opt/etcd/bin/etcd\
-- name=$ {ETCD_NAME}\
-- data-dir=$ {ETCD_DATA_DIR}\
-- listen-peer-urls=$ {ETCD_LISTEN_PEER_URLS}\
-- listen-client-urls=$ {ETCD_LISTEN_CLIENT_URLS}, http://127.0.0.1:2379\
-- advertise-client-urls=$ {ETCD_ADVERTISE_CLIENT_URLS}\
-- initial-advertise-peer-urls=$ {ETCD_INITIAL_ADVERTISE_PEER_URLS}\
-- initial-cluster=$ {ETCD_INITIAL_CLUSTER}\
-- initial-cluster-token=$ {ETCD_INITIAL_CLUSTER_TOKEN}\
-- initial-cluster-state=new\
-- cert-file=/opt/etcd/ssl/server.pem\
-- key-file=/opt/etcd/ssl/server-key.pem\
-- peer-cert-file=/opt/etcd/ssl/server.pem\
-- peer-key-file=/opt/etcd/ssl/server-key.pem\
-- trusted-ca-file=/opt/etcd/ssl/ca.pem\
-- peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target copies the previously generated certificate to / opt/etcd/ssl
Cp ca*pem server*pem / opt/etcd/ssl boot and set boot
Systemctl start etcd
Systemctl enable etcd
Check the status of the cluster
/ opt/etcd/bin/etcdctl-ca-file=/opt/etcd/ssl/ca.pem-cert-file=/opt/etcd/ssl/server.pem-key-file=/opt/etcd/ssl/server-key.pem-endpoints= "https://192.168.56.101:2379,https://192.168.56.102:2379,https://192.168.56.103:2379" cluster-health
Member 181ffe2d394f445b is healthy: got healthy result from https://192.168.56.101:2379
Member 737ab8edec59b6e6 is healthy: got healthy result from https://192.168.56.102:2379
Member 87a3a196a794e8f0 is healthy: got healthy result from https://192.168.56.103:2379
Cluster is healthy
At this point, I believe you have a deeper understanding of "how to install and configure ETCD". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.