環境準備
作業系統:CentOS7
搭建一個三節點的etcd集群
機器名:etcd01 IP地址:192.168.154.133
機器名:etcd03 IP地址:192.168.154.145
機器名:etcd04 IP地址:192.168.154.146
etcd包下載安裝
1、下載
https://github.com/etcd-io/etcd/releases/download/v3.3.1/etcd-v3.3.1-linux-amd64.tar.gz
2.復制二進制命令 到/usr/local/bin
#解壓軟體包
tar -zxvf etcd-v3.3.1-linux-amd64.tar.gz
#將命令復制進環境
cd etcd-v3.3.1-linux-amd64
cp etcd etcdctl /usr/local/bin/
3.在三個節點中創建資料目錄
#創建資料存盤路徑
mkdir -p /var/lib/etcd
4.在每個節點上創建etcd的systemd unit檔案
vim /usr/lib/systemd/system/etcd.service #如果沒有system目錄則新創建一個
三個節點配置如下:注意IP地址相關配置
etcd01
#etcd01節點
[Unit]
Description=etcd server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/local/bin/etcd --name etcd01 --initial-advertise-peer-urls http://192.168.154.133:2380 --listen-peer-urls http://192.168.154.133:2380 --listen-cli
ent-urls http://192.168.154.133:2379,http://127.0.0.1:2379 --advertise-client-urls http://192.168.154.133:2379 --initial-cluster-token etcd-cluster-1 --initial-c
luster etcd03=http://192.168.154.145:2380,etcd04=http://192.168.154.146:2380,etcd01=http://192.168.154.133:2380 --initial-cluster-state new --data-dir=/var/lib/
etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
etcd03節點
vim /usr/lib/systemd/system/etcd.service #如果沒有system目錄則新創建一個
#etcd03節點
[Unit]
Description=etcd server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/local/bin/etcd --name etcd03 --initial-advertise-peer-urls http://192.168.154.145:2380 --listen-peer-urls http://192.168.154.145:2380 --listen-cli
ent-urls http://192.168.154.145:2379,http://127.0.0.1:2379 --advertise-client-urls http://192.168.154.145:2379 --initial-cluster-token etcd-cluster-1 --initial-c
luster etcd03=http://192.168.154.145:2380,etcd04=http://192.168.154.146:2380,etcd01=http://192.168.154.133:2380 --initial-cluster-state new --data-dir=/var/lib/
etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
etcd04節點
vim /usr/lib/systemd/system/etcd.service #如果沒有system目錄則新創建一個
#etcd04節點
[Unit]
Description=etcd server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/local/bin/etcd --name etcd04 --initial-advertise-peer-urls http://192.168.154.146:2380 --listen-peer-urls http://192.168.154.146:2380 --listen-cli
ent-urls http://192.168.154.146:2379,http://127.0.0.1:2379 --advertise-client-urls http://192.168.154.146:2379 --initial-cluster-token etcd-cluster-1 --initial-c
luster etcd03=http://192.168.154.145:2380,etcd04=http://192.168.154.146:2380,etcd01=http://192.168.154.133:2380 --initial-cluster-state new --data-dir=/var/lib/
etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
4.開啟etcd服務:三個節點分別執行
systemctl daemon-reload && systemctl enable etcd && systemctl start etcd
5.相關查看命令
systemctl status etcd.service #查看運行狀態
# 節點的服務運行狀態
● etcd.service - etcd server
Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2022-01-19 18:17:23 CST; 1h 29min ago
Main PID: 4190 (etcd)
Memory: 13.8M
CGroup: /system.slice/etcd.service
└─4190 /usr/local/bin/etcd --name etcd04 --initial-advertise-peer-urls http://192.168.154.146:2380 --listen-peer-urls http://192.168.154.146:2380 -...
1月 19 18:17:23 etcd04 etcd[4190]: serving insecure client requests on 192.168.154.146:2379, this is strongly discouraged!
1月 19 18:17:23 etcd04 etcd[4190]: set the initial cluster version to 3.0
1月 19 18:17:23 etcd04 etcd[4190]: enabled capabilities for version 3.0
1月 19 18:17:24 etcd04 etcd[4190]: peer f5cee01588336622 became active
1月 19 18:17:24 etcd04 etcd[4190]: established a TCP streaming connection with peer f5cee01588336622 (stream Message writer)
1月 19 18:17:24 etcd04 etcd[4190]: established a TCP streaming connection with peer f5cee01588336622 (stream MsgApp v2 writer)
1月 19 18:17:24 etcd04 etcd[4190]: established a TCP streaming connection with peer f5cee01588336622 (stream Message reader)
1月 19 18:17:24 etcd04 etcd[4190]: established a TCP streaming connection with peer f5cee01588336622 (stream MsgApp v2 reader)
1月 19 18:17:27 etcd04 etcd[4190]: updated the cluster version from 3.0 to 3.3
1月 19 18:17:27 etcd04 etcd[4190]: enabled capabilities for version 3.3
etcdctl member list #查看集群中各個節點
#查看集群各節點
[root@etcd01 etcd]# etcdctl member list
23795efc1fd09208: name=etcd01 peerURLs=http://192.168.154.133:2380 clientURLs=http://192.168.154.133:2379 isLeader=true
5789f6b3099dcd29: name=etcd04 peerURLs=http://192.168.154.146:2380 clientURLs=http://192.168.154.146:2379 isLeader=false
f5cee01588336622: name=etcd03 peerURLs=http://192.168.154.145:2380 clientURLs=http://192.168.154.145:2379 isLeader=false
etcdctl cluster-health #查看集群的健康情況
[root@etcd01 etcd]# etcdctl cluster-health
member 23795efc1fd09208 is healthy: got healthy result from http://192.168.154.133:2379
member 5789f6b3099dcd29 is healthy: got healthy result from http://192.168.154.146:2379
member f5cee01588336622 is healthy: got healthy result from http://192.168.154.145:2379
推薦閱讀
【資源推薦】
-
滲透測驗專用系統
- kali-linux-e17-2019.1a-amd64.iso系統鏡像
- kali-linux-e17-2019.1a-amd64.iso系統鏡像_kalilinux2019鏡像-Linux檔案類資源-CSDN下載
- kali-linux-2018.4-amd64 作業系統
- kali-linux-2018.4-amd64作業系統_-Linux檔案類資源-CSDN下載
- manjaro-xfce-17.1.7-stable-x86_64.iso系統鏡像
- manjaro-xfce-17.1.7-stable-x86_64.iso系統鏡像_manjaro鏡像下載-Linux檔案類資源-CSDN下載
- WiFi專用滲透系統 nst-32-11992.x86_64.iso作業系統鏡像
- nst-32-11992.x86_64.iso作業系統鏡像.zip_-Linux檔案類資源-CSDN下載
- Parrot-security-4.1_amd64.iso 作業系統鏡像
- Parrot-security-4.1_amd64.iso作業系統鏡像_Parrot-security-Linux檔案類資源-CSDN下載
- manjaro-xfce-17.1.7-stable-x86_64 作業系統
- manjaro-xfce-17.1.7-stable-x86_64作業系統_-Linux檔案類資源-CSDN下載
- cyborg-hawk-linux-v-1.1 作業系統
- cyborg-hawk-linux-v-1.1作業系統_cyborghwak安裝教程-Linux檔案類資源-CSDN下載
-
滲透測驗相關工具
- 滲透測驗實戰專欄
- 【kali常用工具】抓包工具Charles Windows64位 免費版
- 抓包工具CharlesWindows64位免費版_charleswindows-網路監控檔案類資源-CSDN下載
- 【kali常用工具】圖印工具stamp.zip
- 圖印工具stamp.zip_-制造檔案類資源-CSDN下載
- 【kali常用工具】brutecrack工具[WIFIPR中文版]及wpa/wpa2字典
- brutecrack工具[WIFIPR中文版]及wpa/wpa2字典_wifipr-其它檔案類資源-CSDN下載
- 【kali常用工具】EWSA 5.1.282-破包工具
- 【kali常用工具】EWSA5.1.282-破包工具_kali跑包工具,linux跑包軟體-管理軟體檔案類資源-CSDN下載
- 【kali常用工具】Realtek 8812AU KALI網卡驅動及安裝教程
- 【kali常用工具】Realtek8812AUKALI網卡驅動及安裝教程_8812aukali,kalirtl8812au-網路設備檔案類資源-CSDN下載
- 【kali常用工具】無線信號搜索工具_kali更新
- 【kali常用工具】無線信號搜索工具_kali更新_kali更新-互聯網檔案類資源-CSDN下載
- 【kali常用工具】inssider信號測驗軟體_kali常用工具
- 【kali常用工具】inssider信號測驗軟體_kali常用工具_kali常用工具介紹-網管軟體檔案類資源-CSDN下載
- 【kali常用工具】MAC地址修改工具 保護終端不暴露
- 【kali常用工具】MAC地址修改工具保護終端不暴露_kali修改mac,kalimac地址-Linux檔案類資源-CSDN下載
- 【kali常用工具】腳本管理工具 php和jsp頁面 接收命令引數 在服務器端執行
- 腳本管理工具php和jsp頁面接收命令引數在服務器端執行_-網路安全檔案類資源-CSDN下載
- Java實作照片GPS定位【完整腳本】
- ReadPicExif.zip_-Java檔案類資源-CSDN下載
- Python實作照片GPS定位【完整腳本】
- python定位照片精確位置完整代碼腳本_Python手機號定位-Python檔案類資源-CSDN下載
- 女神忘記相冊密碼 python20行代碼打開【完整腳本】
- 女神忘記相冊密碼python20行代碼打開.py-Python檔案類資源-CSDN下載
- python修改證件照底色、大小、背景、摳圖【完整原始碼】
- python修改證件照底色、大小、背景、摳圖【完整原始碼】_python如何修改證件照的大小-Python檔案類資源-CSDN下載
python實戰
- 【python實戰】前女友婚禮,python破解婚禮現場的WIFI,把名稱改成了
- 【python實戰】前女友發來加密的 “520快樂.pdf“,我用python破解開之后,卻發現
- 【python實戰】昨晚,我用python幫隔壁小姐姐P證件照 自拍,然后發現...
- 【python實戰】女友半夜加班發自拍 python男友用30行代碼發現驚天秘密
- 【python實戰】python你TM太皮了——區區30行代碼就能記錄鍵盤的一舉一動
- 【python實戰】女神相冊密碼忘記了,我只用Python寫了20行代碼~~~
【pygame開發實戰開發30例 完整原始碼】
- pygame游戲26個案例及原始碼【共400M】_pygame游戲作品,pygame游戲原始碼-Python檔案類資源-CSDN下載
【pygame游戲開發專欄,獲取完整原始碼+教程】
- 一起來學pygame吧 游戲開發30例(二)——塔防游戲
- 一起來學pygame吧 游戲開發30例(四)——俄羅斯方塊小游戲
- 滲透測驗實戰專欄
- CSDN官方學習推薦 ↓ ↓ ↓
- CSDN出的Python全堆疊知識圖譜,太強了,推薦給大家!

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/417174.html
標籤:其他
