专业的编程技术博客社区

网站首页 > 博客文章 正文

轻量级分布式任务调度框架(分布式任务调度平台)

baijin 2024-10-25 10:20:28 博客文章 6 ℃ 0 评论

介绍

  • 调度模块和执行模块分离
  • 使用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=true
spring.security.user.name=frost
spring.security.user.password=frost
# 报警通知发送邮件
spring.mail.host=smtp.mail.com
spring.mail.username=
spring.mail.password=
# 邮件通知
frost.notifier.mail.enabled=true
frost.notifier.mail.from=${spring.mail.username}
frost.notifier.mail.to=
frost.notifier.mail.subject=#{job.name} (#{job.id}) throws an exception
frost.notifier.mail.text=#{job.name} (#{job.id}) \n #{event.message}
# 钉钉通知
frost.notifier.dingtalk.enabled=false
frost.notifier.dingtalk.subject=There is something wrong with #{job.name} (#{job.id})
frost.notifier.dingtalk.text=#{job.name} (#{job.id}) \n #{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=50
redisson.masterConnectionPoolSize=50
redisson.timeout=3000
# 单机模式
redisson.address=redis://localhost:6379
# 集群模式
redisson.nodeAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381
redisson.scanInterval=2000
# 云托管模式
redisson.nodeAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381
redisson.scanInterval=2000
redisson.dnsMonitoringInterval=5000
# 哨兵模式
redisson.sentinelAddresses=redis://localhost:6379,redis://localhost:6380,redis://localhost:6381
redisson.scanInterval=2000
redisson.masterName=mymaster
# 主从模式
redisson.masterAddress=redis://127.0.0.1:6379
redisson.slaveAddresses=redis://localhost:6380,redis://localhost:6381
redisson.dnsMonitoringInterval=5000

2.部署项目

正确进行上述配置,可将项目编译打包 mvn package(jar或war,相关打包操作参照Spring boot),调度中心访问地址:http://localhost:20000/center,访问可进入登录界面

登录成功后进入报表页面

3.集群模式

支持集群模式部署,提供调度系统可用性。

集群模式需要注意:保持 登录账号保持一致,保持使用redis配置相同。建议使用Nginx为调度中心做负载均衡

项目地址:

https://gitee.com/justlive1/earth-frost

软件设计开发交流可加入qq群:592246824

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表