docker集群软件之fleet安装

简介:

前几天给大家介绍了docker的集群存储软件etcd的安装(地址http://dl528888.blog.51cto.com/2382721/1623746),今天就再给大家介绍集群的控制软件fleet安装。

fleet的介绍,info里复制的

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

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

下面是我自己画的一个fleet的架构图

wKioL1UTXgmTDweuAAHFbUQTfA4044.jpgfleet与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集群的真实案例。






 本文转自 reinxu 51CTO博客,原文链接:http://blog.51cto.com/dl528888/1624481,如需转载请自行联系原作者

相关文章
|
4天前
|
消息中间件 监控 RocketMQ
Docker部署RocketMQ5.2.0集群
本文详细介绍了如何使用Docker和Docker Compose部署RocketMQ 5.2.0集群。通过创建配置文件、启动集群和验证容器状态,您可以快速搭建起一个RocketMQ集群环境。希望本文能够帮助您更好地理解和应用RocketMQ,提高消息中间件的部署和管理效率。
147 91
|
11天前
|
关系型数据库 MySQL 数据库
Docker Compose V2 安装常用数据库MySQL+Mongo
以上内容涵盖了使用 Docker Compose 安装和管理 MySQL 和 MongoDB 的详细步骤,希望对您有所帮助。
88 42
|
1月前
|
弹性计算 Ubuntu Linux
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS自动化部署。支持Ubuntu 22.04/20.04、CentOS 7.7-7.9及Alibaba Cloud Linux 3.2104 LTS。前提条件:ECS实例需运行中且有公网。步骤:选择Docker扩展并安装,验证成功通过命令`docker -v`查看版本号。
297 79
|
5天前
|
监控 Linux PHP
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
53 20
|
15天前
|
Linux Docker 容器
安装docker-18.06报错Error: libseccomp conflicts with docker-18.06
通过这些步骤,您可以成功在CentOS上安装Docker 18.06,并解决libseccomp的冲突问题。这些方法确保系统兼容性,并保证Docker的正常运行。
53 27
|
5天前
|
Ubuntu API 网络虚拟化
ubuntu22 编译安装docker,和docker容器方式安装 deepseek
本脚本适用于Ubuntu 22.04,主要功能包括编译安装Docker和安装DeepSeek模型。首先通过Apt源配置安装Docker,确保网络稳定(建议使用VPN)。接着下载并配置Docker二进制文件,创建Docker用户组并设置守护进程。随后拉取Debian 12镜像,安装系统必备工具,配置Ollama模型管理器,并最终部署和运行DeepSeek模型,提供API接口进行交互测试。
109 15
|
3天前
|
消息中间件 Kafka Docker
docker compose 安装 kafka
通过本文的步骤,您可以快速在本地使用 Docker Compose 安装并配置 Kafka 和 Zookeeper。Docker Compose 简化了多容器应用的管理,方便快速搭建和测试分布式系统。
30 2
|
2月前
|
NoSQL 关系型数据库 应用服务中间件
docker基础篇:安装tomcat
docker基础篇:安装tomcat
184 64
|
1月前
|
前端开发 应用服务中间件 nginx
docker安装nginx,前端项目运行
通过上述步骤,你可以轻松地在Docker中部署Nginx并运行前端项目。这种方法不仅简化了部署流程,还确保了环境的一致性,提高了开发和运维的效率。确保按步骤操作,并根据项目的具体需求进行相应的配置调整。
123 25
|
1月前
|
安全 数据安全/隐私保护 Docker
docker私有仓库harbor安装
通过以上步骤,您可以成功在企业内部安装和配置Harbor私有仓库,方便地管理和分发Docker镜像。Harbor不仅提供了基础的镜像管理功能,还增强了安全性、身份管理和审计功能,使其成为企业级容器镜像管理的理想选择。
101 22