工作原理

fleet 是通过systemd来控制你的集群的,控制的任务被称之为unit(单元),控制的命令是fleetctl

unit运行方式

unit的运行方式有两种:

  • standard
  • global

standard:unit在一台机器上运行。如果这台机器下线,它将被迁移到一台新机器开始运行。

global:unit将在所有计算机上运行。

查看unit

这有两个命令来查看集群中的单元:

  • list-unit-files
  • list-units

list-unit-files将会列出fleet知道的unit,和他们是否为global。

$ fleetctl list-unit-files
UNIT HASH DSTATE STATE TMACHINE
global-unit.service 8ff68b9 launched launched 3 of 3
standard-unit.service 7710e8a launched launched 148a18ff.../10.10.1.1

list-units将会列出在集群中运行的unit的状态。

$ fleetctl list-units
UNIT MACHINE ACTIVE SUB
global-unit.service 148a18ff.../10.10.1.1 active running
global-unit.service 491586a6.../10.10.1.2 active running
global-unit.service c9de9451.../10.10.1.3 active running
standard-unit.service 148a18ff.../10.10.1.1 active running

查看集群中的机器

fleetctl list-machines命令用于列出集群中的机器

$ fleetctl list-machines
MACHINE IP METADATA
148a18ff-6e95-4cd8-92da-c9de9bb90d5a 10.10.1.1 -
491586a6-508f-4583-a71d-bfc4d146e996 10.10.1.2 -
c9de9451-6a6f-1d80-b7e6-46e996bfc4d1 10.10.1.3 -

在集群中运行容器

运行单个容器是很容易的。所有你需要做的是提供一个普通的没有[install]部分单元文件。让我们来运行systemd入门指南上一个示例。首先保存这些内容myapp.service的CoreOS机器上:

[Unit]
Description=MyApp
After=docker.service
Requires=docker.service [Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill busybox1
ExecStartPre=-/usr/bin/docker rm busybox1
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name busybox1 busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done"
ExecStop=/usr/bin/docker stop busybox1

如果你曾经运行过docker命令,请注意不要使用detached mode (-d),detached mode不会以unit的子线程的方式运行容器,这将会造成unit运行几秒后退出。

用start命令来让它在集群上启动

$ fleetctl start myapp.service

现在它应该已经在服务器上运行了

$ fleetctl list-units
UNIT MACHINE ACTIVE SUB
myapp.service c9de9451.../10.10.1.3 active running

Fleet(集群管理器)的更多相关文章

  1. Spark的集群管理器

    上篇文章谈到Driver节点和Executor节点,但是如果想要运行Driver节点和Executor节点,就不能不说spark的集群管理器.spark的集群管理器大致有三种,一种是自带的standa ...

  2. Spark集群管理器介绍

    Spark可以运行在各种集群管理器上,并通过集群管理器访问集群中的其他机器.Spark主要有三种集群管理器,如果只是想让spark运行起来,可以采用spark自带的独立集群管理器,采用独立部署的模式: ...

  3. ruby redis的集群管理器

    #========================================================================================== # => ...

  4. Kubernetes TensorFlow 默认 特定 集群管理器

    Our goal is to foster an ecosystem of components and tools that relieve the burden of running applic ...

  5. Kubernetes TensorFlow 默认 特定 集群管理器 虚拟化技术

    Our goal is to foster an ecosystem of components and tools that relieve the burden of running applic ...

  6. Docker Swarm 集群管理利器核心概念扫盲

    Swarm 简介 Docker Swarm 是 Docker 官方推出的容器集群管理工具,基于 Go 语言实现.代码开源在:https://github.com/docker/swarm 使用它可以将 ...

  7. 译:Google的大规模集群管理工具Borg(一)------ 用户视角的Borg特性

    概述 Google的Borg系统是一个集群管理工具,在它上面运行着成千上万的job,这些job来自许许多多不同的应用,并且跨越多个集群,而每个集群又由大量的机器构成. Borg通过组合准入控制,高效的 ...

  8. 大规模集群管理工具Borg

    Google的大规模集群管理工具Borg 概述 Google的Borg系统是一个集群管理工具,在它上面运行着成千上万的job,这些job来自许许多多不同的应用,并且跨越多个集群,而每个集群又由大量的机 ...

  9. Docker集群管理工具 - Kubernetes 部署记录 (运维小结)

    一.  Kubernetes 介绍 Kubernetes是一个全新的基于容器技术的分布式架构领先方案, 它是Google在2014年6月开源的一个容器集群管理系统,使用Go语言开发,Kubernete ...

随机推荐

  1. 【Lintcode】106.Convert Sorted List to Balanced BST

    题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height ...

  2. 【Lintcode】087.Remove Node in Binary Search Tree

    题目: Given a root of Binary Search Tree with unique value for each node. Remove the node with given v ...

  3. 如何解决outlook2013邮件规则for other machine的失效问题

    如何解决outlook2013邮件规则for other machine的失效问题 问题描述:因为重装系统,outlook2013进去后->Rules and Alerts->发现所有原来 ...

  4. python爬虫知识点总结(八)Selenium库详解

    官方学习文档:http://selenium-python.readthedocs.io/api.html 一.什么是Selenium? 答:自动化测试工具,支持多种浏览器.用来驱动浏览器,发出指令让 ...

  5. CF 1042A Benches——二分答案(水题)

    题目:http://codeforces.com/problemset/problem/1042/A #include<iostream> #include<cstdio> # ...

  6. Html 5 简介

    html5 是下一代的html 什么是 html5? html5 将成为 html.xhtml 以及 html dom 的新标准. html 的上一个版本诞生于 1999 年.自从那以后,web 世界 ...

  7. js中变量声明提前

    demo1: var a=10; function b(){alert(a); var a=20; alert(a)} b()//undefined 20 因为:js编译器在执行b这个函数时,会把函数 ...

  8. 使用superobject 解析Json数据

    接口数据有如下规范{"error": 0, "msg": "", "data": ...} 其中数据data类型不确定. ...

  9. 了解protected 以及公用、私有和受保护的继承

    protected成员 可以认为protected访问标号是private 和public 的混合: 1.像private成员一样,protected成员不能被类的用户访问. 2.像public成员一 ...

  10. .net core 高吞吐远程方法调用组件XRPC

    XRPC的目标非常明确,就是给.net core平台实现一个百万级别的远程方法调用RPC通讯组件.它的设计理念和GRPC一样,基于连接复用的机制实现高吞的性能:XRPC采用了HTTP2复用的思想,在协 ...