当前位置:网站首页>ETCD containerized to build a cluster
ETCD containerized to build a cluster
2022-08-11 07:05:00 【!Nine thought & & gentleman!】
系列文章目录
文章目录
前言
本文介绍使用docker搭建一个etcd集群,Comes with the corresponding build script.I strongly hope to explain the operation steps and principles in as much detail as possible,make it easier for readers to understand.
一、环境信息
使用本地的vmstation创建3个虚拟机,信息如下
| 节点名称 | 节点IP | 节点配置 | 操作系统 | Etcd版本 | Docker版本 |
|---|---|---|---|---|---|
| etcd1 | 192.168.82.128 | 1c1g 20g | CentOS7.4 | v3.5 | 13.1 |
| etcd2 | 192.168.82.129 | 1c1g 20g | CentOS7.4 | v3.5 | 13.1 |
| etcd3 | 192.168.82.130 | 1c1g 20g | CentOS7.4 | v3.5 | 13.1 |
说明:The server should be able to访问公网,in order to be able to download the corresponding etcd镜像
二、搭建步骤
1.Prepare preconditions
1.1 安装Docker
代码如下(示例):
# 安装docker
yum install -y docker
# 重启docker
systemctl restart docker
# 验证docker
docker ps
备注,需要关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
1.2 拉取镜像
代码如下(示例):
# 拉取镜像
docker pull quay.io/coreos/etcd:v3.5.0
# 验证镜像
docker images|grep etcd
2.安装Etcd
2.1 新建目录
分别在3Create a new directory on each machine /data/etcd,Used to mount into the container,能够讲etcdThe data is persisted to the local disk.需要注意的是,Reproduce the environment as much as possibleetcdThe data directory is mounted on a separate disk,磁盘的io性能越快越好.磁盘的ioThe bandwidth needs to be guaranteed as much as possible40MByte/s以上.否则etcddue to poor disk performance,Lead to constant cutting or unable to complete the foundationwal&snapshot写入,Causes the overall cluster to be abnormal
2.2 编辑脚本
Save the following commands to the script/data/start.sh,用于搭建etcd集群
代码如下(示例):
#! /bin/sh
name="etcd1"
host="192.168.92.128"
cluster="etcd1=http://192.168.92.128:2380,etcd2=http://192.168.92.129:2380,etcd3=http://192.168.92.130:2380"
docker run -d -p 2379:2379 -p 2380:2380 -v /data/etcd:/etcd-data/ --name $name --net=host quay.io/coreos/etcd:v3.5.0 /usr/local/bin/etcd --name $name --data-dir /data/etcd/data --listen-client-urls http://$host:2379 --advertise-client-urls http://$host:2379 --listen-peer-urls http://$host:2380 --initial-advertise-peer-urls http://$host:2380 --initial-cluster $cluster --initial-cluster-token tkn --initial-cluster-state new --log-level info --logger zap --log-outputs stderr
说明:when deployed on different machines,respectively replace in the scripthost和name即可.
2.3 执行部署
分别在3个节点上,Edited and tweaked the scripthost、name配置后,执行bash /data/start.sh命令,创建etcd集群.
三、结果验证
任意选一个节点,执行如下命令,Perform cluster verification,Verify that the build is complete.
代码如下(示例):
export ETCDCTL_API=3
export ETCD_ENDPOINTS=192.168.92.128:2379,192.168.92.129:2379,192.168.92.130:2379
/usr/local/bin/etcdctl --endpoints=192.168.92.128:2379 --write-out=table member list
/usr/local/bin/etcdctl --endpoints=$ETCD_ENDPOINTS --write-out=table endpoint status
注意 member listIs to record all node information in the entire cluster.It does not reflect the current running status of the cluster
endopont statusIt reflects the running status of the current cluster,需要有Leader节点,并且datasize不为0,It means that the cluster is set up normally
总结
If a stand-alone node is runningbash /data/start.sh后,可以通过执行docker ps -a|grep etcdVerify that the container is created.并通过docker logs ${dockerid}method to view the log
参考
边栏推荐
- Windos10专业版开启远程桌面协助
- lvm multi-disk mount, combined use
- 华为防火墙-2-状态检测与会话
- SECURITY DAY01 (Monitoring Overview, Zabbix Basics, Zabbix Monitoring Services)
- 文本三剑客——grep过滤
- 华为防火墙-6
- Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-30
- AUTOMATION DAY06( Ansible进阶 、 Ansible Role)
- Local yum source build
- VMware workstation 16 installation and configuration
猜你喜欢
随机推荐
Solve win10 installed portal v13 / v15 asked repeatedly to restart problem.
buildroot嵌入式文件系统中vi显示行号
CLUSTER DAY03 (Ceph overview, the deployment of Ceph CLUSTER, Ceph block storage)
vi display line number in buildroot embedded file system
SECURITY DAY06( iptables防火墙 、 filter表控制 、 扩展匹配、nat表典型应用 )
FusionCompute8.0.0 实验(2)虚拟机创建
Login error in mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)ERROR
Record a Makefile just written
TCP 三次握手、四次断开
iptables入门
【LeetCode】2034. 股票价格波动(思路+题解)双map
使用路由器DDNS功能+动态公网IP实现外网访问(花生壳)
SECURITY DAY01 (Monitoring Overview, Zabbix Basics, Zabbix Monitoring Services)
文本三剑客——sed 修改、替换
查看可执行文件依赖的库ldd
ETCD容器化搭建集群
内存调试工具Electric Fence
(三)软件测试理论(了解软件的缺陷知识)
SECURITY DAY05(Kali系统 、 扫描与抓包 、 SSH基本防护、服务安全 )
No threat of science and technology - TVD vulnerability information daily - 2022-7-21










