In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Etcd is an open source distributed key-value database, each of its nodes has a copy of data, which ensures high availability when there is a node failure. Etcd uses the Raft algorithm to ensure consistency.
Special reminder: if there is v2 data when using v3 to back up data, the recovery will not be affected.
If the data of v3 exists when using v2 to back up data, the recovery fails.
Etcd V2 new node (delete data and rejoin)
Suitable for single node failure and rejoin the cluster
The only difference between V2 and V3 new nodes is the member add parameter.
Stop the etcd service
# systemctl stop etcd
# clear etcd data data
# mv / var/lib/etcd/default.etcd / tmp
# View etcd list
# / opt/kubernetes/bin/etcdctl-ca-file=ca.pem-cert-file=server.pem-key-file=server-key.pem-endpoints= "https://172.30.0.89:2379,https://172.30.0.81:2379,https://172.30.2.10:2379" member list
# remove existing etcd name
# / opt/kubernetes/bin/etcdctl-ca-file=ca.pem-cert-file=server.pem-key-file=server-key.pem-endpoints= "https://172.30.0.89:2379,https://172.30.0.81:2379,https://172.30.2.10:2379" member remove a4ec138b3529c929
# add etcd node
# V2
# / opt/kubernetes/bin/etcdctl-ca-file=/opt/kubernetes/ssl/ca.pem-cert-file=/opt/kubernetes/ssl/server.pem-key-file=/opt/kubernetes/ssl/server-key.pem member add etcd03 https://172.30.0.89:2380
# V3
# ETCDCTL_API=3 / opt/kubernetes/bin/etcdctl-endpoints= https://172.30.2.10:2379,etcd02=https://172.30.0.81:2379,etcd03=https://172.30.0.89:2379-cacert=/opt/kubernetes/ssl/ca.pem-cert=/opt/kubernetes/ssl/server.pem-key=/opt/kubernetes/ssl/server-key.pem member add etcd03-peer-urls= "https://172.30.0.89:2380"
# modify the node etcd configuration ETCD_INITIAL_CLUSTER_STATE= "existing"
# restart all etcd at the same time
# systemctl restart etcd
Etcd data backup and recovery (cluster unavailable, disaster recovery)
Note: a single node can back up a copy of current or historical data, which needs to be synchronized to all nodes during recovery. If you only want to restore one node, you will report request cluster ID mismatch in the system log.
No nodes join, because a new cluster id will be created, which is equivalent to rebuilding a new cluster (data retention, cluster id changes)
# stop apiserver (the cluster is unavailable, so you can keep writing if you confirm that there is no write)
# stop etcd service
Systemctl stop etcd
# data backup
# ETCDCTL_API=3 / opt/kubernetes/bin/etcdctl snapshot save / var/lib/etcd/etcd_backup/etcd_$ (date "+% Y%m%d%H%M%S") .db
# synchronize backup data to each node
# scp etcd_$ (date "+% Y%m%d%H%M%S") .etcd nodes of db cluster
# remove data directory
Mv / var/lib/etcd/default.etcd / tmp
# Snapshot recovery data can be modified by changing name and initial-advertise-peer-urls to current nodes
# ETCDCTL_API=3 / opt/kubernetes/bin/etcdctl snapshot-cacert=/opt/kubernetes/ssl/ca.pem-cert=/opt/kubernetes/ssl/server.pem-key=/opt/kubernetes/ssl/server-key.pem restore / var/lib/etcd/etcd_20190903102702.db-name=etcd01-data-dir=/var/lib/etcd/default.etcd-initial-cluster= "etcd01= https://172.30.2.10:2380,etcd02=https://172.30.0.81:2380, Etcd03= https://172.30.0.89:2380"-initial-cluster-token= "etcd-cluster"-initial-advertise-peer-urls= https://172.30.2.10:2380
# restart etcd
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.