当前位置:网站首页>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 etcd
Verify that the container is created.并通过docker logs ${dockerid}
method to view the log
参考
边栏推荐
- cloudreve使用体验
- VMware workstation 16 installation and configuration
- ETCD集群故障应急恢复-从snapshot恢复
- MySQL中忘记用户密码怎么办?
- HCIP-BGP的选路实验
- HPC平台搭建
- SECURITY DAY06 ( iptables firewall, filter table control, extended matching, typical application of nat table)
- WiFi Deauth 攻击演示分析 // mdk4 // aireplay-ng// Kali // wireshark //
- grep、sed、awk
- iptables 流量统计
猜你喜欢
随机推荐
What should I do if I forget the user password in MySQL?
HPC平台搭建
buildroot嵌入式文件系统中vi显示行号
AUTOMATION DAY07 (Ansible Vault, ordinary users use ansible)
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-8-3
从mask-rcnn到shp
ssh中的密码登录和密钥登录
MySQL中忘记用户密码怎么办?
Numpy_备注
SECURITY DAY05(Kali系统 、 扫描与抓包 、 SSH基本防护、服务安全 )
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-20
vnc remote desktop installation (available for personal testing on 2021-10-20)
【LeetCode】1036. 逃离大迷宫(思路+题解)压缩矩阵+BFS
Record a Makefile just written
Login error in mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)ERROR
SECURITY DAY06 ( iptables firewall, filter table control, extended matching, typical application of nat table)
FusionCompute8.0.0 实验(2)虚拟机创建
SECURITY DAY02 (Zabbix alarm mechanism, Zabbix advanced operation and monitoring case)
CLUSTER DAY01(集群及LVS简介 、 LVS-NAT集群 、 LVS-DR集群)
mysql数据库安装教程(超级超级详细)