介绍
- 调度模块和执行模块分离
- 使用redis作为数据库
- 基于订阅模式实现服务注册和发现
- 演示地址: http://www.justlive.vip (请勿恶意攻击)
环境
- Angular: v1.x
- JDK: 1.8+
- Maven: 3+
- Redis: 2.8+
- Spring boot: 2.x
- Thymeleaf: 3
功能
1.0.0
- 简单易上手,支持web界面进行任务的CRUD
- 支持动态修改任务的开始,停止
- 调度中心支持集群部署,将任务的调度进行封装,支持分配各种不同的任务
- 执行器支持分布式,支持集群部署,可进行相应分组,在调度中心界面查看
- 支持伸缩扩展,调度中心和执行器都是基于redis订阅模式进行服务注册发现和任务调度,服务上下线发现及时
- 支持失败重试
- 任务监控和报警
- 动态编译任务,支持web界面编辑任务源码,创建任务
- 支持父子任务
- 运行报表
1.1.0
- 支持钉钉预警通知
- 调度记录增加执行时间
- 任务超时报警机制
- 支持分片任务
- 支持SimpleTrigger任务
- 支持非spring项目开发执行器
- misfire
开发
frost-api对外实体和接口frost-core定义调度、执行、注册发现等核心功能的接口和实现frost-center调度中心服务,包含安全认证和UI展示,依赖core实现调度逻辑frost-executor执行器服务,依赖core实现任务执行逻辑,包含开发脚本任务的部分实例以及配置样例frost-client客户端api,第三方项目可依赖client实现与调度中心交互
快速入门
- 启动Redis数据库
请下载并安装2.8+版本的Redis,单机或集群模式皆可。
调度中心和执行器均支持集群模式部署,集群模式下各节点需配置相同的Redis服务
- 导入源码
解压源码,按maven格式将源码导入IDE,源码结构如上述 [开发] 章节。
配置部署调度中心
1.配置内容说明
# 登录账号spring.boot.auth.enabled=truespring.security.user.name=frostspring.security.user.password=frost# 报警通知发送邮件spring.mail.host=smtp.mail.comspring.mail.username=spring.mail.password=# 邮件通知frost.notifier.mail.enabled=truefrost.notifier.mail.from=${spring.mail.username}frost.notifier.mail.to=frost.notifier.mail.subject=#{job.name} (#{job.id}) throws an exceptionfrost.notifier.mail.text=#{job.name} (#{job.id}) #{event.message}# 钉钉通知frost.notifier.dingtalk.enabled=falsefrost.notifier.dingtalk.subject=There is something wrong with #{job.name} (#{job.id})frost.notifier.dingtalk.text=#{job.name} (#{job.id}) #{event.message}frost.notifier.dingtalk.accessToken=frost.notifier.dingtalk.linkUrl=localhost:20000/center# redis配置# 0:单机模式, 1:集群模式,2:云托管模式,3:哨兵模式,4:主从模式redisson.mode=0# 公共配置redisson.password=redisson.slaveConnectionPoolSize=50redisson.masterConnectionPoolSize=50redisson.timeout=3000# 单机模式redisson.address=redis://localhost:6379# 集群模式redisson.nodeAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381redisson.scanInterval=2000# 云托管模式redisson.nodeAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381redisson.scanInterval=2000redisson.dnsMonitoringInterval=5000# 哨兵模式redisson.sentinelAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381redisson.scanInterval=2000redisson.masterName=mymaster# 主从模式redisson.masterAddress=redis://127.0.0.1:6379redisson.slaveAddresses=redis://localhost:6380,redis://localhost:6381redisson.dnsMonitoringInterval=5000
2.部署项目
正确进行上述配置,可将项目编译打包 mvn package(jar或war,相关打包操作参照Spring boot),调度中心访问地址:http://localhost:20000/center,访问可进入登录界面
登录成功后进入报表页面
3.集群模式
支持集群模式部署,提供调度系统可用性。
集群模式需要注意:保持 登录账号保持一致,保持使用redis配置相同。建议使用Nginx为调度中心做负载均衡
项目地址:
https://gitee.com/justlive1/earth-frost
软件设计开发交流可加入qq群:592246824