docker (centOS 7) 使用笔记4 - etcd服务
本次测试的系统包含centos 7.2 64 bit,centos 7.3 64 bit
1. 安装
yum -y install etcd
2. 配置
此处一共准备了3台机器(10.10.10.100, 10.10.10.101, 10.10.10.102)
(1) etcd服务的配置和启动方式
启用etcd服务
systemctl enable etcd
修改服务配置 /etc/systemd/system/multi-user.target.wants/etcd.service,其中的启动指令(ExecStart=)
修改配置后,装载配置,重启服务
systemctl daemon-reload
systemctl restart etcd
启动成功后,可以看到新增加了2个监听端口:2379, 2380
(2) 集群配置
第1个节点(10.10.10.100) (注意:第一次启动时,--initial-cluster-state new,启动成功后,集群已经创建,此时需修改为 --initial-cluster-state existing。否则下次重启服务会失败。):
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd0\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.100:2379\" --initial-advertise-peer-urls=\"http://10.10.10.100:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" --initial-cluster-state new "
后面的节点可以先手工添加信息:
etcdctl member add etcd1 http://10.10.10.101:2380
etcdctl member add etcd2 http://10.10.10.102:2380
第2个节点(10.10.10.101):
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd1\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.101:2379\" --initial-advertise-peer-urls=\"http://10.10.10.101:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" "
第3个节点(10.10.10.102):
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd2\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.102:2379\" --initial-advertise-peer-urls=\"http://10.10.10.102:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" "
启动成功后可以查看集群状态,member 列表
# etcdctl cluster-health
member 17294cb126466d4d is healthy: got healthy result from http://10.10.10.100:2379
member a17abe451cf50cbd is healthy: got healthy result from http://10.10.10.101:2379
member f4a143b3a5f1cdf7 is healthy: got healthy result from http://10.10.10.102:2379
cluster is healthy
# etcdctl member list
17294cb126466d4d: name=etcd2 peerURLs=http://10.10.10.100:2380 clientURLs=http://10.28.148.46:2379 isLeader=false
a17abe451cf50cbd: name=etcd0 peerURLs=http://10.10.10.101:2380 clientURLs=http://10.28.148.61:2379 isLeader=true
f4a143b3a5f1cdf7: name=etcd1 peerURLs=http://10.10.10.102:2380 clientURLs=http://10.28.148.57:2379 isLeader=false
docker (centOS 7) 使用笔记4 - etcd服务的更多相关文章
- docker (centOS 7) 使用笔记6 - skydns
skydns被用于kubenets作为DNS服务.本次测试是单独使用skydns作为DNS服务器,且作为loadbalance使用. 前提:需要先安装配置etcd服务 (在前面的文章里,已经安装部署了 ...
- docker (centOS 7) 使用笔记2 - 使用nfs作为volume
本次测试的服务器2台,服务器#1(centos7)最为docker容器所在的host,服务器#2(centos6)提供NFS服务 1. #2上配置NFS服务 (1) 安装nfs软件包 yum -y i ...
- docker (centOS 7) 使用笔记1
1. docker配置 初次在安装完docker后,初始化配置 copy默认的docker.service后,重启服务,会在/etc/systemd/system/multi-user.target. ...
- Docker Swarm Mode 学习笔记 (部署服务)
使用 docker service 命令来管理 Swarm 集群中的服务,该命令只能在管理节点上执行. 新建服务 docker service create --replicas 3 -p 80:80 ...
- docker (centOS 7) 使用笔记5 - weave网络
weave官网 https://www.weave.works 1. 下载安装 sudo curl -L git.io/weave -o /usr/local/bin/weave sudo chmod ...
- docker (centOS 7) 使用笔记3 - docker swarm mode
1. 什么是docker swarm mode docker engine自带的 容器管理 工具.功能比较早的 docker swarm 更多,且集成在docker engine里. (docker ...
- docker (centOS 7) 使用笔记3 - 修改docker默认的虚拟网址
近日在使用VPN时发现和docker的虚拟网址发生了冲突,都是172.17.0.1,故需要修改docker的默认网址. 1. 当前状态 # ifconfig docker0: flags=<UP ...
- 物联网架构成长之路(22)-Docker练习之Etcd服务搭建
0. 前言 时隔多日,前段时间忙完一个可有可无的项目后,又进入摸鱼时间,没有办法,非互联网公司,就是闲得蛋疼.又开始了自学之路.以前入门过Docker,然后又很久没有看了,最近重新看了一下,推荐一下这 ...
- Docker CentOS / Ubuntu容器开启 SSH 服务
Docker CentOS / Ubuntu容器开启 SSH 服务 在CentOS容器内执行 yum install passwd openssl openssh-server -y # Ubuntu ...
随机推荐
- sencha touch 入门学习资料大全
现在sencha touch已经更新到2.3.1版本了 重新整理一下资料 官方网站:http://www.sencha.com/products/touch/ 在线文档:http://docs.sen ...
- 如何理解JavaScript中的this关键字
前言 王福朋老师的 JavaScript原型和闭包系列 文章看了不下三遍了,最为一个初学者,每次看的时候都会有一种 "大彻大悟" 的感觉,而看完之后却总是一脸懵逼.原型与闭包 可以 ...
- Java微信公众号开发----关键字自动回复消息
在配置好开发者配置后,本人第一个想要实现的是自动回复消息的功能,说明以下几点: 1. url 仍然不变,还是开发配置里的url 2. 微信采用 xml 格式传输数据 3.微信服务器传给我们的参数主要有 ...
- Voyager下的Settings方法
设置网站标题,logo,描述: 自定义setting字段,添加group为文章,key为title的字段: 添加成功: 前端页面写法: <img src="{{ Voyager::im ...
- 不依赖Hibernate的万能BaseDao---模仿了Hibernate底层的原理
今天写了个万能的BaseDao:有了这个BaseDao以后的Dao层直接继承这个BaseDao就能直接操作数据库了,增删改查,这是一个简易的Hibernate模型.写这个BaseDao的原因是最近在学 ...
- PHP将unicode转utf8最简法
最近开发时遇到Unicode编码问题,找了半天才知道PHP并没有Unicode转码函数,终于发现用一行PHP代码解决的方案: $str = '{"success":true,&qu ...
- Python头脑风暴3
驾校是个暴利行业 如果有高学历靠谱的IT人员做驾校教练等等等等.... Python虽然难做企业级应用,但Python是全球个人自定义应用的首选!!!没有之一,所有语言最快的开发速度,最个性化的私人定 ...
- eclipse使用技巧的网站收集——转载(一)
Eclipse工具使用技巧总结(转载) 首先推荐一篇非常好的How to use eclipse文章 ,讲的是eclipse使用的方方面面,非常实用,推荐给大家! 一.常用快捷键:Ctrl+F11 运 ...
- 水题:51Nod 1163-最高的奖励
最高的奖励 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 Description 有N个任务,每个任务有一个最晚结束时间以及一个对应的奖励.在结束时间之前完成该任 ...
- 安装repo
$ sudo apt-get install curl -y$ curl "http://android.git.linaro.org/gitweb?p=tools/repo.git;a=b ...