金庸武功之“七伤拳”--etcd集群搭建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了金庸武功之“七伤拳”--etcd集群搭建相关的知识,希望对你有一定的参考价值。

环境

etcd01:192.168.93.201,centos7.2

etcd02:192.168.93.203,centos7.2

etcd03:192.168.93.203,centos7.2

软件版本:

etcd:2.3.7


实施步骤:

以etcd1部署为例,其他2个主机步骤一样:


安装etcd

[[email protected] ~]# yum install etcd -y


修改配置文件

vi /etc/etcd//etcd.conf 


ETCD_NAME=etcd01


ETCD_DATA_DIR="/var/lib/etcd/etcd01"


ETCD_LISTEN_PEER_URLS="http://192.168.93.201:2380"


ETCD_LISTEN_CLIENT_URLS="http://192.168.93.201:2379,http://127.0.0.1:2379"


ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.93.201:2380"


ETCD_INITIAL_CLUSTER="etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http://192.168.93.203:2380"


ETCD_INITIAL_CLUSTER_STATE="new"


ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-00"


ETCD_ADVERTISE_CLIENT_URLS="http://192.168.93.201:2379"


###########################################################################

ETCD_NAME=etcd02


ETCD_DATA_DIR="/var/lib/etcd/etcd01"


ETCD_LISTEN_PEER_URLS="http://192.168.93.202:2380"


ETCD_LISTEN_CLIENT_URLS="http://192.168.93.202:2379,http://127.0.0.1:2379"


ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.93.202:2380"


ETCD_INITIAL_CLUSTER="etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http://192.168.93.203:2380"


ETCD_INITIAL_CLUSTER_STATE="new"


ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-00"


ETCD_ADVERTISE_CLIENT_URLS="http://192.168.93.202:2379"



####################################################################


ETCD_NAME=etcd03


ETCD_DATA_DIR="/var/lib/etcd/etcd01"


ETCD_LISTEN_PEER_URLS="http://192.168.93.203:2380"


ETCD_LISTEN_CLIENT_URLS="http://192.168.93.203:2379,http://127.0.0.1:2379"


ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.93.203:2380"


ETCD_INITIAL_CLUSTER="etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http://192.168.93.203:2380"


ETCD_INITIAL_CLUSTER_STATE="new"


ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-00"


ETCD_ADVERTISE_CLIENT_URLS="http://192.168.93.203:2379"


##################################################################################


注意别因为复制时少内容导致集群起不来



确认etcd启动文件


less /usr/lib/systemd/system/etcd.service


[Unit]

Description=Etcd Server

After=network.target

After=network-online.target

Wants=network-online.target


[Service]

Type=notify

WorkingDirectory=/var/lib/etcd/

EnvironmentFile=-/etc/etcd/etcd.conf

User=etcd

# set GOMAXPROCS to number of processors

ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\""

Restart=on-failure

LimitNOFILE=65536


[Install]

WantedBy=multi-user.target



更新启动:

systemctl daemon-reload
systemctl start etcd
systemctl enable etcd



校验状态:


etcdctl member list 
etcdctl cluster-health








以上是关于金庸武功之“七伤拳”--etcd集群搭建的主要内容,如果未能解决你的问题,请参考以下文章

金庸武功之“神照经”--RPM包制作

金庸武功之“无毒掌”---jenkins安装部署

金庸武功之“碧血剑法”----squid做透明代理

金庸武功之“”天山折梅手“”-elk5.2

金庸武功之“”左右互搏术“”postgresql 主从异步流复制配置

金庸武功之““兰花拂穴手””--elk5.5安装