博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Docker 搭建 etcd 集群配置
阅读量:4684 次
发布时间:2019-06-09

本文共 2981 字,大约阅读时间需要 9 分钟。

#关闭selinux、防火墙

systemctl stop firewalld.servicesystemctl disable firewalld.servicefirewall-cmd --statesed -i '/^SELINUX=.*/c SELINUX=disabled' /etc/selinux/configsed -i 's/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g' /etc/selinux/configgrep --color=auto '^SELINUX' /etc/selinux/configsetenforce 0

 

# 节点node1

docker run -d --name etcd --restart=always \    -p 2379:2379 \    -p 2380:2380 \    kubernetes/etcd:v3.2.4 \    /usr/local/bin/etcd \    --name node1 \    --initial-advertise-peer-urls http://172.19.15.92:2380 --listen-peer-urls http://0.0.0.0:2380 \    --advertise-client-urls http://172.19.15.92:2379 --listen-client-urls http://0.0.0.0:2379 \    --initial-cluster-state new \    --initial-cluster-token docker-etcd \    --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

 

# 节点node2

docker run -d --name etcd --restart=always \    -p 2379:2379 \    -p 2380:2380 \    kubernetes/etcd:v3.2.4 \    /usr/local/bin/etcd \    --name node2 \    --initial-advertise-peer-urls http://172.19.15.93:2380 --listen-peer-urls http://0.0.0.0:2380 \    --advertise-client-urls http://172.19.15.93:2379 --listen-client-urls http://0.0.0.0:2379 \    --initial-cluster-state new \    --initial-cluster-token docker-etcd \    --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

 

# 节点node3

docker run -d --name etcd --restart=always \    -p 2379:2379 \    -p 2380:2380 \    kubernetes/etcd:v3.2.4 \    /usr/local/bin/etcd \    --name node3 \    --initial-advertise-peer-urls http://172.19.15.94:2380 --listen-peer-urls http://0.0.0.0:2380 \    --advertise-client-urls http://172.19.15.94:2379 --listen-client-urls http://0.0.0.0:2379 \    --initial-cluster-state new \    --initial-cluster-token docker-etcd \    --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

 

# 配置网络

1 [root@k8s ~]# docker exec etcd etcdctl set /k8s/network/config '{"Network":"192.100.0.1/16"}'2 {
"Network":"192.100.0.1/16"}

 

# 查看 etcd 成员

1 [root@k8s ~]# docker exec etcd etcdctl member list2 14a0991cbae18c78: name=node3 peerURLs=http://172.19.15.94:2380 clientURLs=http://172.19.15.94:2379 isLeader=false3 33a95350dcc12573: name=node1 peerURLs=http://172.19.15.92:2380 clientURLs=http://172.19.15.92:2379 isLeader=true4 6cb8872859c66c95: name=node2 peerURLs=http://172.19.15.93:2380 clientURLs=http://172.19.15.93:2379 isLeader=false

 

# 查看 etcd 健康状态

1 [root@k8s ~]# docker exec etcd etcdctl cluster-health2 member 14a0991cbae18c78 is healthy: got healthy result from http://172.19.15.94:23793 member 33a95350dcc12573 is healthy: got healthy result from http://172.19.15.92:23794 member 6cb8872859c66c95 is healthy: got healthy result from http://172.19.15.93:23795 cluster is healthy

 

# docker 命令行启动

1 /usr/bin/dockerd --registry-mirror=http://f2d6cb40.m.daocloud.io --bip=192.100.68.1/24

 

转载于:https://www.cnblogs.com/wangjq19920210/p/9267893.html

你可能感兴趣的文章
2015年创业中遇到的技术问题:51-60
查看>>
FansUnion:共同写博客计划终究还是“流产”了
查看>>
中国象棋程序的设计与实现(六)--N皇后问题的算法设计与实现(源码+注释+截图)...
查看>>
mobiscroll 日期问题
查看>>
<jsp:include>和<%@include%>的区别
查看>>
poj 1691 搜索
查看>>
win7/win8下vmware/VirtualBox虚拟网卡显示未识别网络的解决
查看>>
PCA vs Linear Regression 可视化理解
查看>>
python 二维字典
查看>>
编译原理实验一
查看>>
Git for Android Studio 学习笔记
查看>>
pip 警告!The default format will switch to columns in the future
查看>>
Arrays类学习笔记
查看>>
graphite积累(二)
查看>>
[转]JAVA 反射及使用
查看>>
实验吧之【天下武功唯快不破】
查看>>
c# 生成各种标准条码实例
查看>>
MUTABLE和IMMUTABLE集合
查看>>
忘记MySQL root密码重置MySQL root密码
查看>>
mongodump备份数据库
查看>>