操作系统: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游戏开发专栏,获取完整源码+教程】
CSDN官方学习推荐 ↓ ↓ ↓CSDN出的Python全栈知识图谱,太强了,推荐给大家!



