etcd集群搭建

主机环境和分配规划:

主机ip   主机名   操作系统环境   操作系统版本
172.17.0.2 etcd01 centos 7.9
172.17.0.3 etcd02 centos 7.9
172.17.0.4 etcd03 centos 7.9

etcd官网下载,我这边下载的是v3.4.32版本https://objects.githubusercontent.com/github-production-release-asset-2e65be/11225014/219b0bb3-0a6c-4ec9-a7c3-69163804ad02?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240511%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240511T064321Z&X-Amz-Expires=300&X-Amz-Signature=d0282d2326d9d647c35911723fa4d9687d8269c6bd036b3314c17fc6ba5b026f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=11225014&response-content-disposition=attachment%3B%20filename%3Detcd-v3.4.32-linux-amd64.tar.gz&response-content-type=application%2Foctet-stream

没有启用ssl部署

解压拷贝两个文件到/usr/bin/下


cp etcd /usr/bin/ && cp etcdctl /usr/bin/

直接二进制脚本启动加载配置

# etcd01
/usr/bin/etcd --name etcd1 \
--data-dir /etc/etcd/data \
--listen-client-urls http://172.17.0.2:2379 \
--advertise-client-urls http://172.17.0.2:2379 \
--listen-peer-urls http://172.17.0.2:2380 \
--initial-advertise-peer-urls http://172.17.0.2:2380 \
--initial-cluster-token etcd-cluster \
--initial-cluster "etcd1=http://172.17.0.2:2380,etcd2=http://172.17.0.3:2380,etcd3=http://172.17.0.4:2380" \
--initial-cluster-state new \
--logger zap

# etcd02
/usr/bin/etcd --name etcd2 \
--data-dir /etc/etcd/data \
--listen-client-urls http://172.17.0.3:2379 \
--advertise-client-urls http://172.17.0.3:2379 \
--listen-peer-urls http://172.17.0.3:2380 \
--initial-advertise-peer-urls http://172.17.0.3:2380 \
--initial-cluster-token etcd-cluster \
--initial-cluster "etcd1=http://172.17.0.2:2380,etcd2=http://172.17.0.3:2380,etcd3=http://172.17.0.4:2380" \
--initial-cluster-state new \
--logger zap

# etcd03
/usr/bin/etcd \
--name etcd3 \
--data-dir /etc/etcd/data \
--listen-client-urls http://172.17.0.4:2379 \
--advertise-client-urls http://172.17.0.4:2379 \
--listen-peer-urls http://172.17.0.4:2380 \
--initial-advertise-peer-urls http://172.17.0.4:2380 \
--initial-cluster-token etcd-cluster \
--initial-cluster "etcd1=http://172.17.0.2:2380,etcd2=http://172.17.0.3:2380,etcd3=http://172.17.0.4:2380" \
--initial-cluster-state new \
--logger zap

启动后检查集群状态

etcdctl --endpoints http://172.17.0.2:2380,http://172.17.0.3:2380,http://172.17.0.4:2380 endpoint health
etcdctl -w table --endpoints http://172.17.0.2:2380,http://172.17.0.3:2380,http://172.17.0.4:2380 endpoint status

 

posted @ 2024-05-13 14:41  dididi崩了  阅读(10)  评论(0编辑  收藏  举报