【原创】大数据基础之Chronos

官方:https://mesos.github.io/chronos/
mesos集群中替换crontab
Chronos
A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules
简介
Chronos is a replacement for cron. It is a distributed and fault-tolerant scheduler that runs on top of Apache Mesos that can be used for job orchestration. It supports custom Mesos executors as well as the default command executor. Thus by default, Chronos executes sh (on most systems bash) scripts.
Chronos can be used to interact with systems such as Hadoop (incl. EMR), even if the Mesos slaves on which execution happens do not have Hadoop installed. Chronos is also natively able to schedule jobs that run inside Docker containers.
Chronos has a number of advantages over regular cron. It allows you to schedule your jobs using ISO8601 repeating interval notation, which enables more flexibility in job scheduling. Chronos also supports the definition of jobs triggered by the completion of other jobs. It supports arbitrarily long dependency chains.
工作过程
Internally, the Chronos scheduler main loop is quite simple. The pattern is as follows:
- Chronos reads all job state from the state store (ZooKeeper)
- Jobs are registered within the scheduler and loaded into the job graph for tracking dependencies.
- Jobs are separated into a list of those which should be run at the current time (based on the clock of the host machine), and those which should not.
- Jobs in the list of jobs to run are queued, and will be launched as soon as a sufficient offer becomes available.
- Chronos will sleep until the next job is scheduled to run, and begin again from step 1.
chronos通过zk来维护任务状态,任务会随机分配到一个mesos slave节点运行
安装
前提是已经部署好zk和mesos
$ docker run --net=host -e PORT0=8080 -e PORT1=8081 mesosphere/chronos:v3.0.0 --zk_hosts $zk_ip:2181 --master zk://$zk_ip:2181/mesos
其中第一个端口是http端口
使用
访问 http://localhost:8080

添加任务

只需要配置
- 任务名称
- 时间间隔
- 要执行的shell命令/脚本
其中shell命令也可以替换为启动docker容器,如下图:

时间间隔格式示例:
R/2019-06-19T14:40:00.000+08:00/PT5M
以上配置为在北京时间下每5分钟执行
任务执行之后可以在mesos上找到任务执行记录

任务定义以及执行状态都可以在zk上找到
[zk: localhost:2181(CONNECTED) 7] get /chronos/state/state/J_ $job_name
只需要完成一个通用的shell脚本,这个shell脚本根据参数首先将一个hdfs目录(任务目录,包括脚本和配置等)下载到本地,然后进入目录执行参数中的命令,即可实现分布式任务调度;
$ do_job.sh $hdfs_path $cmd
参考:https://hub.docker.com/r/mesosphere/chronos/
【原创】大数据基础之Chronos的更多相关文章
- 【原创】大数据基础之Zookeeper(2)源代码解析
核心枚举 public enum ServerState { LOOKING, FOLLOWING, LEADING, OBSERVING; } zookeeper服务器状态:刚启动LOOKING,f ...
- 【原创】大数据基础之词频统计Word Count
对文件进行词频统计,是一个大数据领域的hello word级别的应用,来看下实现有多简单: 1 Linux单机处理 egrep -o "\b[[:alpha:]]+\b" test ...
- 【原创】大数据基础之Impala(1)简介、安装、使用
impala2.12 官方:http://impala.apache.org/ 一 简介 Apache Impala is the open source, native analytic datab ...
- 【原创】大数据基础之Benchmark(2)TPC-DS
tpc 官方:http://www.tpc.org/ 一 简介 The TPC is a non-profit corporation founded to define transaction pr ...
- 大数据基础知识:分布式计算、服务器集群[zz]
大数据中的数据量非常巨大,达到了PB级别.而且这庞大的数据之中,不仅仅包括结构化数据(如数字.符号等数据),还包括非结构化数据(如文本.图像.声音.视频等数据).这使得大数据的存储,管理和处理很难利用 ...
- 大数据基础知识问答----spark篇,大数据生态圈
Spark相关知识点 1.Spark基础知识 1.Spark是什么? UCBerkeley AMPlab所开源的类HadoopMapReduce的通用的并行计算框架 dfsSpark基于mapredu ...
- 大数据基础知识问答----hadoop篇
handoop相关知识点 1.Hadoop是什么? Hadoop是一个由Apache基金会所开发的分布式系统基础架构.用户可以在不了解分布式底层细节的情况下,开发分布式程序.充分利用集群的威力进行高速 ...
- hadoop大数据基础框架技术详解
一.什么是大数据 进入本世纪以来,尤其是2010年之后,随着互联网特别是移动互联网的发展,数据的增长呈爆炸趋势,已经很难估计全世界的电子设备中存储的数据到底有多少,描述数据系统的数据量的计量单位从MB ...
- 大数据基础总结---HDFS分布式文件系统
HDFS分布式文件系统 文件系统的基本概述 文件系统定义:文件系统是一种存储和组织计算机数据的方法,它使得对其访问和查找变得容易. 文件名:在文件系统中,文件名是用于定位存储位置. 元数据(Metad ...
随机推荐
- 前端知识点回顾之重点篇——CSS中vertical align属性
来源:https://www.cnblogs.com/shuiyi/p/5597187.html 行框的概念 红色(line-height)为行框的顶部和底部,绿色(font-size)为字体的高度, ...
- Android跨进程通信广播(Broadcast)
广播是一种被动跨进程通讯的方式.当某个程序向系统发送广播时,其他的应用程序只能被动地接收广播数据.这就象电台进行广播一样,听众只能被动地收听,而不能主动与电台进行沟通,在应用程序中发送广播比较简单.只 ...
- 1.4 Go语言基础之流程控制
流程控制是每种编程语言控制逻辑走向和执行次序的重要部分,流程控制可以说是一门语言的"经脉". Go语言中最常用的流程控制有if和for,而switch和goto主要是为了简化代码. ...
- Oracle事务、视图、序列
回顾什么是事务? 一个不可分割的子操作形成一个整体,该整体要么全部执行成功,要么全部执行失败.例如:转帐 回顾为什么要用事务? 如果不用事务的话,为转帐为例,可能出现一个用户钱增加了,另一个用户钱不变 ...
- Oracle Database的基本概念
一个 Oracle 服务器:是一个关系数据库管理系统(RDBMS),它提供全面的, 近乎完整的信息管理由Oracle 实例和Oracle 数据库组成Oracle 数据库 和 Oracle 实例Orac ...
- 如何打开DOS控制台
A:xp下如何打开DOS控制台? a:开始--程序--附件--命令提示符 b:开始--运行--cmd--回车 c:win+r--cmd--回车 B:win7下如何打开DOS控制台? a:开始--所有程 ...
- ECLIPSE 安卓项目 迁移 android stiod
JNI 处理 http://www.cnblogs.com/flyme/p/4431762.html 导入ECLIPSE项目 http://blog.csdn.net/molei1991/articl ...
- java运行环境搭建
java运行环境搭建 1.安装jdk下载和安装 1). java是Sun公司的产品,由于Sun公司被Oracle公司收购,因此jdk可以在Oracle的官网下载.网址:https://www.orac ...
- 深入理解C语言-结构体做函数参数
结构体做函数参数,在C语言中属于常见现象,此时为了内存考虑,不传递结构体,而是传递结构体的地址 结构体定义 struct Man { char name[64]; int age; }; 结构体可以与 ...
- maven 编译,测试,打包和安装工程
编译工程,使用命令mvn compile 测试工程,使用命令mvn test 测试和编译工程,使用命令mvn test-compile 打包工程,使用命令mvn package,将工程打包成jar\w ...