etcd v3 ssl 集群添加新节点

摘要:
集群搭建下面只用同一台服务器进行三个成员节点的开启节点1./etcd--namecd0--initial-advertise-peer-urlshttp://127.0.0.1:2380--listen-peer-urlshttp://127.0.0.1:2380--listen-client-urlshttp://127.0.0.1:2379--advertise-client-urlshttp

集群搭建

下面只用同一台服务器进行三个成员节点的开启

节点1

./etcd --name cd0 --initial-advertise-peer-urls http://127.0.0.1:2380 --listen-peer-urls http://127.0.0.1:2380 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --initial-cluster-token etcd-cluster-1 --initial-cluster cd0=http://127.0.0.1:2380,cd1=http://127.0.0.1:2480,cd2=http://127.0.0.1:2580 --initial-cluster-state new

节点2

./etcd --name cd1 --initial-advertise-peer-urls http://127.0.0.1:2480 --listen-peer-urls http://127.0.0.1:2480 --listen-client-urls http://127.0.0.1:2479 --advertise-client-urls http://127.0.0.1:2479 --initial-cluster-token etcd-cluster-1 --initial-cluster cd0=http://127.0.0.1:2380,cd1=http://127.0.0.1:2480,cd2=http://127.0.0.1:2580 --initial-cluster-state new

节点3

./etcd --name cd2 --initial-advertise-peer-urls http://127.0.0.1:2580 --listen-peer-urls http://127.0.0.1:2580 --listen-client-urls http://127.0.0.1:2579 --advertise-client-urls http://127.0.0.1:2579 --initial-cluster-token etcd-cluster-1 --initial-cluster cd0=http://127.0.0.1:2380,cd1=http://127.0.0.1:2480,cd2=http://127.0.0.1:2580 --initial-cluster-state new

查询 member 列表

export ETCDCTL_API=3
ENDPOINTS=127.0.0.1:2379,127.0.0.1:2479,127.0.0.1:2579
./etcdctl --endpoints=$ENDPOINTS member list

运行结果:

98f0c6bf64240842, started, cd2, http://127.0.0.1:2580, http://127.0.0.1:2579
bf9071f4639c75cc, started, cd0, http://127.0.0.1:2380, http://127.0.0.1:2379
e3ba87c3b4858ef1, started, cd1, http://127.0.0.1:2480, http://127.0.0.1:2479

添加 member 节点

member add 添加节点

./etcdctl --endpoints=$ENDPOINTS member add cd3 --peer-urls=http://127.0.0.1:2180
Member b9057cfdc8ff17ce added to cluster 9da8cd75487bd6dc

运行结果:

ETCD_NAME="cd3"
ETCD_INITIAL_CLUSTER="cd2=http://127.0.0.1:2580,cd3=http://127.0.0.1:2180,cd0=http://127.0.0.1:2380,cd1=http://127.0.0.1:2480"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://127.0.0.1:2180"
ETCD_INITIAL_CLUSTER_STATE="existing"

查询 member 节点列表信息

./etcdctl --endpoints=$ENDPOINTS member list

运行结果:

98f0c6bf64240842, started, cd2, http://127.0.0.1:2580, http://127.0.0.1:2579
b9057cfdc8ff17ce, unstarted, , http://127.0.0.1:2180, 
bf9071f4639c75cc, started, cd0, http://127.0.0.1:2380, http://127.0.0.1:2379
e3ba87c3b4858ef1, started, cd1, http://127.0.0.1:2480, http://127.0.0.1:2479

通过查询结果可以发现:http://127.0.0.1:2180 显示状态为:unstarted

启动新节点

./etcd --name cd3 --listen-client-urls http://127.0.0.1:2179 --advertise-client-urls http://127.0.0.1:2179 --listen-peer-urls http://127.0.0.1:2180 --initial-advertise-peer-urls http://127.0.0.1:2180 --initial-cluster-state existing --initial-cluster cd2=http://127.0.0.1:2580,cd0=http://127.0.0.1:2380,cd3=http://127.0.0.1:2180,cd1=http://127.0.0.1:2480 --initial-cluster-token etcd-cluster-1

查询 member 节点列表信息

./etcdctl --endpoints=$ENDPOINTS member list

运行结果:

98f0c6bf64240842, started, cd2, http://127.0.0.1:2580, http://127.0.0.1:2579
b9057cfdc8ff17ce, started, cd3, http://127.0.0.1:2180, http://127.0.0.1:2179
bf9071f4639c75cc, started, cd0, http://127.0.0.1:2380, http://127.0.0.1:2379
e3ba87c3b4858ef1, started, cd1, http://127.0.0.1:2480, http://127.0.0.1:2479

删除 member

./etcdctl --endpoints=$ENDPOINTS member remove b9057cfdc8ff17ce

运行结果:

Member b9057cfdc8ff17ce removed from cluster 9da8cd75487bd6dc

查询 member 节点列表信息

./etcdctl --endpoints=$ENDPOINTS member list

运行结果:

98f0c6bf64240842, started, cd2, http://127.0.0.1:2580, http://127.0.0.1:2579
bf9071f4639c75cc, started, cd0, http://127.0.0.1:2380, http://127.0.0.1:2379
e3ba87c3b4858ef1, started, cd1, http://127.0.0.1:2480, http://127.0.0.1:2479

作者:RickJay
链接:https://www.jianshu.com/p/00185e3eb579
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

免责声明:文章转载自《etcd v3 ssl 集群添加新节点》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇WinForm 异步调用方法关于H5在微信获取授权下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

微服务架构学习与思考(08):服务注册中心(服务注册与服务发现)

为什么会有服务注册中心 为什么会有服务注册中心? 在 client-server 服务-请求模式中,客户端发送请求到服务端,完成一次服务请求。这时候,开发也比较简单,写服务端代码就可以完成这种模式了。 但是,随着业务的发展,功能会越来越多,对外提供的服务也会随之增多。 服务越来越多,怎么才能对众多服务进行简单高效的管理?由原静态的,变更(比如增加、删除等)...

OpenShift实战(一):OpenShift安装

1.1 服务器基本信息   本次安装采用一个master、5个node、3个etcd,node节点两块硬盘,60G磁盘用于docker storage,xxx改为自己的域名或主机名 节点/主机名 功能 IP 内存 磁盘 CPU      master1.xxx.net Master节点 192.168.10.110 16G 40G 8C nod...

3.kubernetes的CNI网络插件-Flannel

目录 1.1.K8S的CNI网络插件-Flannel 1.1.1.集群规划 1.1.2.下载软件、解压、软链接 1.1.3.最终目录结构 1.1.4.拷贝证书 1.1.5.创建配置 1.1.6.创建启动脚本 1.1.7.检查配置、权限、创建日志目录 1.1.8.操作etcd、增加host-gw 1.1.9.创建supervisor配置 1.1.10.启动服...

Etcd入门教程

etcd是一个类似于zk的工具,用于保存值,节点-值这种映射关系的。节点组织结构类似unix文件系统结构,从/最开始。比如一个/test/name节点,值为guanxianseng。可以通过etcdctl这个客户端,执行命令 etcdctl set /test/name guanxianseng 也可以通过客户端命令,获取我们设置的值 etcdctl ge...

查看k8s中etcd数据

1.查看ETCD集群中运行的ETCD pod [root@master1 ~]# kubectl get pod -n kube-system | grep etcd etcd-master1 1/1 Running 0 61m etcd-master2...

etcd集群日常维护

配置文件和启动参数说明 命令行 | 配置文件 | 说明 data-dir | ETCD_DATA_DIR | 指定节点的数据存储目录,包括节点ID,集群ID...