首页 > 其他分享 >etcd集群部署文档

etcd集群部署文档

时间:2022-09-07 14:13:12浏览次数:63  
标签:http NAME v3.5 -- 2380 集群 etcd 文档

1.部署的服务器ip地址
   172.16.0.151
   172.16.0.173
   172.16.0.220
2.etcd版本
	wget  https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz
3.三台服务器安装目录 /data/ 
4.启动脚本
	cd /data/etcd-v3.5.0
	[root@im-03 etcd-v3.5.0]cat etcd.sh
	#For each machine
	TOKEN=my-etcd-token-1
	CLUSTER_STATE=new
	NAME_1=etcd_1
	NAME_2=etcd_2
	NAME_3=etcd_3
	HOST_1=172.16.0.151
	HOST_2=172.16.0.173
	HOST_3=172.16.0.220
	CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380

	# For node 1
	THIS_NAME=${NAME_1}
	THIS_IP=${HOST_1}
	/data/etcd-v3.5.0/etcd --data-dir=/data/etcd-v3.5.0/data.etcd --name ${THIS_NAME} \
	--initial-advertise-peer-urls http://${THIS_IP}:2380 \
	--listen-peer-urls http://${THIS_IP}:2380 \
	--advertise-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--listen-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--initial-cluster ${CLUSTER} \
	--initial-cluster-state ${CLUSTER_STATE} \
	--initial-cluster-token ${TOKEN} > /data/etcd-v3.5.0/etcd.out 2>&1 &

	
	
	[root@im-04 etcd-v3.5.0]cat etcd.sh
	#for each machine
	TOKEN=my-etcd-token-1
	CLUSTER_STATE=new
	NAME_1=etcd_1
	NAME_2=etcd_2
	NAME_3=etcd_3
	HOST_1=172.16.0.151
	HOST_2=172.16.0.173
	HOST_3=172.16.0.220
	CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380

	# For node 2
	THIS_NAME=${NAME_2}
	THIS_IP=${HOST_2}
	/data/etcd-v3.5.0/etcd --data-dir=/data/etcd-v3.5.0/data.etcd --name ${THIS_NAME} \
	--initial-advertise-peer-urls http://${THIS_IP}:2380 \
	--listen-peer-urls http://${THIS_IP}:2380 \
	--advertise-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--listen-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--initial-cluster ${CLUSTER} \
	--initial-cluster-state ${CLUSTER_STATE} \
	--initial-cluster-token ${TOKEN} > /data/etcd-v3.5.0/etcd.out 2>&1 &
	
	[root@im-05 etcd-v3.5.0]cat etcd.sh
	# For each machine
	TOKEN=my-etcd-token-1
	CLUSTER_STATE=new
	NAME_1=etcd_1
	NAME_2=etcd_2
	NAME_3=etcd_3
	HOST_1=172.16.0.151
	HOST_2=172.16.0.173
	HOST_3=172.16.0.220
	CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380

	# For node 3
	THIS_NAME=${NAME_3}
	THIS_IP=${HOST_3}
	/data/etcd-v3.5.0/etcd --data-dir=/data/etcd-v3.5.0/data.etcd --name ${THIS_NAME} \
	--initial-advertise-peer-urls http://${THIS_IP}:2380 \
	--listen-peer-urls http://${THIS_IP}:2380 \
	--advertise-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--listen-client-urls http://${THIS_IP}:2379,http://127.0.0.1:2379 \
	--initial-cluster ${CLUSTER} \
	--initial-cluster-state ${CLUSTER_STATE} \
	--initial-cluster-token ${TOKEN} > /data/etcd-v3.5.0/etcd.out 2>&1 &

5.三台服务器分别执行etcd.sh赋予执行权限并启动
	chmod +x /data/etcd-v3.5.0/etcd.sh
	/data/etcd-v3.5.0/etcd.sh
6.三台服务器分别执行建立软连接
[root@im-05 etcd-v3.5.0]# ln -s /data/etcd-v3.5.0/etcd /usr/local/bin/etcd
[root@im-05 etcd-v3.5.0]# ln -s /data/etcd-v3.5.0/etcdctl /usr/local/bin/etcdctl
[root@im-05 etcd-v3.5.0]# ln -s /data/etcd-v3.5.0/etcdutl /usr/local/bin/etcdutl
7./usr/local/bin/加入环境变量
    vim /etc/profile
	export PATH=/usr/local/bin/:$PATH
	
8.	执行命令 source /etc/profile
	
9.
(1)查看集群成员健康情况:
[root@im-05 etcd-v3.5.0]# etcdctl endpoint health --endpoints="http://172.16.0.151:2380,http://172.16.0.173:2380,http://172.16.0.220:2380"
http://172.16.0.173:2380 is healthy: successfully committed proposal: took = 4.430984ms
http://172.16.0.151:2380 is healthy: successfully committed proposal: took = 4.378476ms
http://172.16.0.220:2380 is healthy: successfully committed proposal: took = 4.759539ms

(2)查看集群成员列表:
[root@im-05 etcd-v3.5.0]# etcdctl member list
88ba7d086f91dc5e, started, etcd_3, http://172.16.0.220:2380, http://127.0.0.1:2379,http://172.16.0.220:2379, false
932d1a5425ec0f72, started, etcd_2, http://172.16.0.173:2380, http://127.0.0.1:2379,http://172.16.0.173:2379, false
f0ac2546d16a17f4, started, etcd_1, http://172.16.0.151:2380, http://127.0.0.1:2379,http://172.16.0.151:2379, false

10.参考文档	

	https://www.cnblogs.com/hanease/p/16332130.html
	https://cloud.tencent.com/developer/article/1890434
	https://www.cnblogs.com/wujuntian/p/15121004.html
		

  

标签:http,NAME,v3.5,--,2380,集群,etcd,文档
From: https://www.cnblogs.com/zxqblogrecord/p/16665203.html

相关文章

  • mongos集群部署
    mongos分片服务器https://blog.csdn.net/weixin_49724150/article/details/1217483651.部署的服务器ip地址172.16.0.151172.16.0.173172.16.0.2202.......
  • zookeeper集群部署
    1.部署的服务器ip地址172.16.0.151172.16.0.173172.16.0.2202.zookeeper版本wgethttps://mirrors.bfsu.edu.cn/apache/zookeeper/zookeeper-3.7.1/ap......
  • Ceph集群应用基础-CephFS文件存储
    在mgr1上安装ceph-mds服务,可以和其他服务器混用(如ceph-mon、ceph-mgr)root@mgr1:~#apt-cachemadisonceph-mdsroot@mgr1:~#aptinstallceph-md=16.2.10-1bionic把mgr......
  • redis 集群安装
    1.前期准备安装ruby升级ruby参见前一篇前期准备#EPEL源安装ruby支持yuminstallrubyrubygems-y使用国内源gemsource-ahttp://mirrors.aliyun.com/rubyge......
  • Ceph集群应用基础-RGW对象存储
    部署radodgw服务,将mgr服务器部署为RGW主机aptinstallradosgw=16.2.10-1bionicceph-deploy--overwrite-confrgwcreatemgr1 直接浏览器访问,能访问到说明启动成功......
  • Ceph集群应用基础-块存储RBD
    块存储RBD基础创建RBD创建存储池,制定pg和pgp的数量,pgp是对存在于pg的数据进行组合存储,pgp通常等于pg的值cephosdpoolcreatemyrbd16464对存储池启用RBD功能ceph......
  • 利用docker-compose快速搭建kafka集群
    一、安装docker-compose工具安装docker-compose事先需要安装docker,这里需要自行安装#升级pippip3install--upgradepip#指定docker-compose版本安装pipinst......
  • 【论文笔记】LayoutLM:首次结合文本和版式信息的文档预训练模型
    概述LayoutLM是一个基于Bert,结合了文本和版式信息的文档预训练模型,在多个下游任务中都达到了当时SOTA的结果。模型模型的总体结构如图1所示:图1LayoutLM总体结构La......
  • springboot官方文档解读
    官网地址:https://docs.spring.io/spring-boot/docs/2.7.3/reference/htmlsingle/1第一个springboot项目我们在一个路径下面创建pom.xml文件<?xmlversion="1.0"encod......
  • unittestreport 详细功能使用文档(V1.1.1)
    测试派:http://testingpai.com/article/1598939124642详细文档见:https://unittestreport.readthedocs.io/en/latest/......