etcd多实例配置

多实例进行配置,分别在多个不同端口进行监听,避免开启单机部署监听端口冲突;

查看go版本:

bash 复制代码
go version

若没有go环境,则进行下载,解压至/usr/local后进行环境配置,编辑vim ~./bashrc

bash 复制代码
vim ~./bashrc
bash 复制代码
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

最后确保环境成功

bash 复制代码
source ~/.bashrc

随后安装goreman

Go 复制代码
go install github.com/mattn/goreman@latest
goreman help

配置文件

Go 复制代码
etcd1: etcd --name infra1 --listen-client-urls http://127.0.0.1:12379 --advertise-client-urls http://127.0.0.1:12379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr

etcd2: etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr

etcd3: etcd --name infra3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr

执行相关start

Go 复制代码
goreman -f local_cluster_procfile  start

启动完成之后查看集群内的成员

Go 复制代码
etcdctl --endpoints=http://localhost:22379  member list

关闭某个节点

Go 复制代码
goreman run stop etcd2

重启某个节点

Go 复制代码
goreman run restart etcd2

多节点情况下,指定添加某一节点的数据

当中止一个节点时,其他节点正常运行,可以访问,中止节点无法继续访问

相关推荐
Felven3 小时前
stress-ng 与 fio 性能测试工具使用指南
linux·测试工具·fio·stress-ng
huainingning4 小时前
RJ SW Console口忘记密码处理方法
linux·运维·服务器
布裘4 小时前
【银河麒麟】桌面系统循环登录,无法进入桌面?
linux·运维·服务器
慧都小项5 小时前
程序到了Linux才出错?用CLion把调试接到目标环境
linux·运维·服务器
Ruiery7 小时前
Linux 6.6内核内存管理深度解析(一):物理内存初始化 — memblock 怎么把内存交给 buddy
linux·运维·服务器
2401_868534787 小时前
无线网络规划设计
服务器·网络
库拉镜像AI牛牛7 小时前
短剧内容自动化生产:知漫剧工作室落地教程
大数据·服务器·前端·人工智能·语音识别
天蓝蓝的本我7 小时前
conda日常用到的命令积累1-登录linux,安装pycharm
linux·pycharm·conda
Android系统攻城狮7 小时前
Linux Gstreamer深度解析之gst_audio_encoder_get_frame_max调用流程与实战(五十九)
linux·运维·服务器·gstreamer音视频·音视频进阶·gstreamer音视频进阶
l1t8 小时前
DeepSeek总结的一个不含数据的 DuckDB 数据库
服务器·数据库·duckdb