码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-12-16 20:18:12      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:配置文件   软件版本   金庸   主机   

环境

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

[root@kube ~]# 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集群搭建

标签:配置文件   软件版本   金庸   主机   

原文地址:http://mxlmgl.blog.51cto.com/9834691/1883283

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!