设为首页 收藏本站
查看: 2186|回复: 0

[经验分享] docker集群软件之fleet安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-3-27 10:02:41 | 显示全部楼层 |阅读模式
fleet的介绍,info里复制的

1
fleet 是一个通过 Systemd对CoreOS 集群中进行控制和管理的工具。fleet 与 Systemd 之间通过 D-Bus API 进行交互,每个 fleet agent 之间通过 etcd 服务来注册和同步数据。fleet 提供的功能非常丰富,包括查看集群中服务器的状态、启动或终止 Docker container、读取日志内容等。



简单来说,我搭建docker集群,使用etcd作为信息存储,fleet连接与控制所有节点服务器的systemd,然后通过想用的命令创建或者消灭节点里docker容器。
下面是我自己画的一个fleet的架构图

QQ截图20150327100230.png fleet与etcd都是coreos开发,内置到coreos系统里,但我后来在弄docker集群的时候,在centos7系统里部署与使用这2个软件,使用起来很方便。
下面是安装
1、安装go

1
yum install go -y



2、下载fleet
1
2
cd /tmp/
git clone https://github.com/coreos/fleet.git



3、安装fleet
1
2
cd fleet
./build



4、负责可执行程序
1
2
cp bin/fleetd /usr/local/bin/
cp bin/fleetctl /usr/local/bin/



5、配置fleet

在某一个节点里编辑与配置/etc/fleet/fleet.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
09:15:02 # cat /etc/fleet/fleet.conf
# This config file is INI-formatted

# Lower the logging threshold. Acceptable values are 0, 1, and 2. A higher
# value corresponds to a lower logging threshold.
# verbosity=0

# Provide a custom set of etcd endpoints. The default value is determined
# by the underlying go-etcd library.
#etcd_servers=["http://192.168.65.2:4001"]

# Amount of time in seconds to allow a single etcd request before considering it failed.
# etcd_request_timeout=1.0

# Provide TLS configuration when SSL certificate authentication is enabled in etcd endpoints
# etcd_cafile=/path/to/CAfile
# etcd_keyfile=/path/to/keyfile
# etcd_certfile=/path/to/certfile

# IP address that should be published with any socket information. By default,
# no IP address is published.
public_ip="10.10.27.221"

# Comma-delimited key/value pairs that are published to the fleet registry.
# This data can be referenced in unit files to affect scheduling descisions.
# An example could look like: metadata="region=us-west,az=us-west-1"
metadata="region=cn-core-02"

# An Agent will be considered dead if it exceeds this amount of time to
# communicate with the Registry. The agent will attempt a heartbeat at half
# of this value.
# agent_ttl="30s"

# Interval at which the engine should reconcile the cluster schedule in etcd.
# engine_reconcile_interval=2



基本只需要修改public_ip与metadata
6、配置启动脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
09:16:14 # cat /usr/lib/systemd/system/fleet.service;
[Unit]
Description=Fleet
Documentation=https://github.com/coreos/fleet

[Service]
Type=simple
EnvironmentFile=-/etc/fleet/fleet.conf
ExecStart=/usr/local/bin/fleetd -config /etc/fleet/fleet.conf
ExecStop=/usr/bin/killall -9 fleetd
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target



7、启动fleet
1
systemctl start fleet



8、查看集群状态
我目前已经创建好了集群,并且有了4个节点
1
2
3
4
5
6
09:15:06 # fleetctl list-machines -l
MACHINE                 IP      METADATA
1a1b60030aaef2f1d8d0468f0000002d    10.10.21.199    region=cn-core-01
6d832c54a40fe752dba35d0b00000024    10.10.27.221    region=cn-core-02
893b160e363b4ec7834719a7f06e67cf    10.10.17.3  region=cn-core-04
cce83e1dd55b46f6a543b49a6b59586a    10.10.17.3  region=cn-core-03



其中machine是一个主机唯一的标示,ip是之前配置fleet.conf里的public_ip项,metadata是fleet.conf里metadata的。
目前已经建立好集群,请直接安装fleet前一定要先在每个节点安装etcd,否则fleet无法工作的,之后给大家整体介绍一个docker集群的真实案例。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-51086-1-1.html 上篇帖子: 如何让Windows 8/Windows 10用户也用上Docker 下篇帖子: 搭建Docker私有仓库 软件
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表