我是靠谱客的博主 贤惠大门,最近开发中收集的这篇文章主要介绍etcd静态集群部署(Centos 3节点),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

当确定集群的成员个数及其信息,可以使用静态模式(Static)部署集群,具体步骤如下:

一、机器信息

hostnameip系统版本
infra0172.17.0.2CentOS Linux release 7.4.1708 (Core)
infra1172.17.0.3CentOS Linux release 7.4.1708 (Core)
infra2172.17.0.4CentOS Linux release 7.4.1708 (Core)

二、下载etcd二进制包

wget https://github.com/coreos/etcd/releases/download/v3.2.10/etcd-v3.2.10-linux-amd64.tar.gz
tar -xf etcd-v3.2.10-linux-amd64.tar.gz
sudo mv etcd-v3.2.10-linux-amd64/etcd* /usr/local/bin/
etcd --version 
--------------------------------
etcd Version: 3.2.10
Git SHA: 694728c
Go Version: go1.8.5
Go OS/Arch: linux/amd64
--------------------------------

etcdctl --version
------------------------------
etcdctl version: 3.2.10
API version: 2-
------------------------------

三、启动节点

1.infra0节点执行命令

NODE_INFRA0_IP=172.17.0.2
NODE_INFRA1_IP=172.17.0.3
NODE_INFRA2_IP=172.17.0.4
mkdir -p /data/etcd/data_dir
nohup etcd --name infra0 --data-dir /data/etcd/data_dir 
  --initial-advertise-peer-urls http://${NODE_INFRA0_IP}:2380 
  --listen-peer-urls http://${NODE_INFRA0_IP}:2380 
  --listen-client-urls http://${NODE_INFRA0_IP}:2379,http://127.0.0.1:2379 
  --advertise-client-urls http://${NODE_INFRA0_IP}:2379 
  --initial-cluster-token etcd-cluster-1 
  --initial-cluster infra0=http://${NODE_INFRA0_IP}:2380,infra1=http://${NODE_INFRA1_IP}:2380,infra2=http://${NODE_INFRA2_IP}:2380 
  --initial-cluster-state new >> /data/etcd/etcd.log 2>&1 &

2.infra1节点执行命令

NODE_INFRA0_IP=172.17.0.2
NODE_INFRA1_IP=172.17.0.3
NODE_INFRA2_IP=172.17.0.4
mkdir -p /data/etcd/data_dir
nohup etcd --name infra1 --data-dir /data/etcd/data_dir 
  --initial-advertise-peer-urls http://${NODE_INFRA1_IP}:2380 
  --listen-peer-urls http://${NODE_INFRA1_IP}:2380 
  --listen-client-urls http://${NODE_INFRA1_IP}:2379,http://127.0.0.1:2379 
  --advertise-client-urls http://${NODE_INFRA1_IP}:2379 
  --initial-cluster-token etcd-cluster-1 
  --initial-cluster infra0=http://${NODE_INFRA0_IP}:2380,infra1=http://${NODE_INFRA1_IP}:2380,infra2=http://${NODE_INFRA2_IP}:2380 
  --initial-cluster-state new >> /data/etcd/etcd.log 2>&1 &

3.infra2节点执行命令

NODE_INFRA0_IP=172.17.0.2
NODE_INFRA1_IP=172.17.0.3
NODE_INFRA2_IP=172.17.0.4
mkdir -p /data/etcd/data_dir
nohup etcd --name infra2 --data-dir /data/etcd/data_dir 
  --initial-advertise-peer-urls http://${NODE_INFRA2_IP}:2380 
  --listen-peer-urls http://${NODE_INFRA2_IP}:2380 
  --listen-client-urls http://${NODE_INFRA2_IP}:2379,http://127.0.0.1:2379 
  --advertise-client-urls http://${NODE_INFRA2_IP}:2379 
  --initial-cluster-token etcd-cluster-1 
  --initial-cluster infra0=http://${NODE_INFRA0_IP}:2380,infra1=http://${NODE_INFRA1_IP}:2380,infra2=http://${NODE_INFRA2_IP}:2380 
  --initial-cluster-state new >> /data/etcd/etcd.log 2>&1 &

四、检查集群状态

etcdctl cluster-health #在任意节点执行

member 9198227ac1a2c055 is healthy: got healthy result from http://172.17.0.3:2379
member 983274ac8c0149ec is healthy: got healthy result from http://172.17.0.2:2379
member ab3fbede047aa1ac is healthy: got healthy result from http://172.17.0.4:2379
cluster is healthy

参考官方文档:https://coreos.com/etcd/docs/latest/v2/clustering.html#static

转载于:https://www.cnblogs.com/TatuCz/p/7878019.html

最后

以上就是贤惠大门为你收集整理的etcd静态集群部署(Centos 3节点)的全部内容,希望文章能够帮你解决etcd静态集群部署(Centos 3节点)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部