All Projects → holdno → Gophercron

holdno / Gophercron

golang 开箱即用的秒级分布式定时任务系统

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Gophercron

Deno cron
A cron Job scheduler for Deno that allows you to write human readable cron syntax with tons of flexibility
Stars: ✭ 35 (-76.03%)
Mutual labels:  crontab
Go Crond
⏰ Cron daemon written in golang (for eg. usage in docker images)
Stars: ✭ 59 (-59.59%)
Mutual labels:  crontab
Job
JOB, make your short-term command as a long-term job. 将命令行规划成任务的工具
Stars: ✭ 98 (-32.88%)
Mutual labels:  crontab
Routine
go routine control, abstraction of the Main and some useful Executors.如果你不会管理Goroutine的话,用它
Stars: ✭ 40 (-72.6%)
Mutual labels:  crontab
Jiacrontab
简单可信赖的任务管理工具
Stars: ✭ 1,052 (+620.55%)
Mutual labels:  crontab
Crontab
Parse Cron Expressions, Compose Cron Expression Strings and Caluclate Execution Dates.
Stars: ✭ 62 (-57.53%)
Mutual labels:  crontab
Cron Editor
cron editor
Stars: ✭ 22 (-84.93%)
Mutual labels:  crontab
Go Quartz
Simple, zero-dependency scheduling library for Go
Stars: ✭ 118 (-19.18%)
Mutual labels:  crontab
Bulwark Explorer
Block explorer for Bulwark Cryptocurrency
Stars: ✭ 57 (-60.96%)
Mutual labels:  crontab
Cronmon
定时任务执行状态监控
Stars: ✭ 90 (-38.36%)
Mutual labels:  crontab
Zeit
Qt frontend to at & crontab CLI utilities
Stars: ✭ 42 (-71.23%)
Mutual labels:  crontab
Vue Cron Generator
Cron Generator Implemented by Vue.js and Element-ui(基于Vue&Element-UI构建的在线Cron表达式生成器)
Stars: ✭ 48 (-67.12%)
Mutual labels:  crontab
Ppgo job
PPGo_Job是一款可视化的、多人多权限的、一任务多机执行的定时任务管理系统,采用golang开发,安装方便,资源消耗少,支持大并发,可同时管理多台服务器上的定时任务。
Stars: ✭ 1,152 (+689.04%)
Mutual labels:  crontab
Cronicle
A simple, distributed task scheduler and runner with a web based UI.
Stars: ✭ 979 (+570.55%)
Mutual labels:  crontab
Crontabmanager
PHP library for GNU/Linux cron jobs management.
Stars: ✭ 113 (-22.6%)
Mutual labels:  crontab
Bree
🚥 The best job scheduler for Node.js and JavaScript with cron, dates, ms, later, and human-friendly support. Works in Node v10+ and browsers, uses workers to spawn sandboxed processes, and supports async/await, retries, throttling, concurrency, and graceful shutdown. Simple, fast, and lightweight. Made for @ForwardEmail and @ladjs.
Stars: ✭ 933 (+539.04%)
Mutual labels:  crontab
How To Mine Newsfeed Data And Extract Interactive Insights In Python
A practical guide to topic mining and interactive visualizations
Stars: ✭ 61 (-58.22%)
Mutual labels:  crontab
Quantum Core
⌚ Cron-like job scheduler for Elixir
Stars: ✭ 1,905 (+1204.79%)
Mutual labels:  crontab
Crontab Ui
Easy and safe way to manage your crontab file
Stars: ✭ 1,786 (+1123.29%)
Mutual labels:  crontab
Krontab
⏰ A crontab like editor for Kubernetes cron jobs
Stars: ✭ 90 (-38.36%)
Mutual labels:  crontab

firetower logo

Downloads Build Status Package Utilities Version license

GopherCron

开箱即用的分布式可视化crontab

可以通过配置文件指定某个节点所受理的业务线,从而做到业务统一管理但隔离调度

依赖

  • Etcd # 服务注册与发现
  • Gin # webapi 提供可视化操作
  • Mysql # 任务日志存储
  • cronexpr # github.com/gorhill/cronexpr cron表达式解析器

实现功能

  • 秒级定时任务
  • 任务日志查看
  • 随时结束任务进程
  • 分布式扩展
  • 健康节点检测 (分项目显示对应的健康节点IP及节点数)

任务日志集中上报

1.10.x版本中client配置增加了report_addr项,该配置接收一个http接口
配置后,任务日志将通过http发送到该地址进行集中处理
可通过请求中的Head参数 Report-Type 来判断是告警还是日志来做对应的处理
日志结构(参考:common/protocol.go 下的 TaskExecuteResult):

// TaskExecuteResult 任务执行结果
type TaskExecuteResult struct {
	ExecuteInfo *TaskExecutingInfo `json:"execute_info"`
	Output      string             `json:"output"`     // 程序输出
	Err         string             `json:"error"`      // 是否发生错误
	StartTime   time.Time          `json:"start_time"` // 开始时间
	EndTime     time.Time          `json:"end_time"`   // 结束时间
}

日志上报相关代码参考 app/taskreport.go

cronexpr 秒级cron表达式介绍(引用)

* * * * * * * 
Field name     Mandatory?   Allowed values    Allowed special characters
----------     ----------   --------------    --------------------------
Seconds        No           0-59              * / , -
Minutes        Yes          0-59              * / , -
Hours          Yes          0-23              * / , -
Day of month   Yes          1-31              * / , - L W
Month          Yes          1-12 or JAN-DEC   * / , -
Day of week    Yes          0-6 or SUN-SAT    * / , - L #
Year           No           1970–2099         * / , -

使用方法

下载项目到本地并编译,根据cmd文件夹下service和client中包含的conf/config-default.toml进行配置

service 配置文件

log_level = "debug"

[deploy]
# 当前的环境:dev、release
environment = "release"
# 对外提供的端口
host = ["0.0.0.0:6306"]
# 数据库操作超时时间
timeout = 5  # 秒为单位
# 前端文件路径
view_path = "./view"

# etcd
[etcd]
service = ["0.0.0.0:2379"]
username = ""
password = ""
dialtimeout = 5000
# etcd kv存储的key前缀 用来与其他业务做区分
prefix = "/gopher_cron"

[mysql]
service="0.0.0.0:3306"
username=""
password=""
database=""

# jwt用来做api的身份校验
[jwt]
# jwt签名的secret 建议修改
secret = "fjskfjls2ifeew2mn"
exp = 168  # token 有效期(小时)

service 部署

$ ./gophercron service -c ./config/service-config-default.toml // 配置文件名请随意  
2019-01-18 00:00:45 listening and serving HTTP on 0.0.0.0:6306

client 配置文件

log_level = "debug"
# 日志统一上报接口(http协议),如配置此接口可忽略mysql的配置
report_addr = "" 

[deploy]
# 当前的环境:dev、release
environment = "release"
# 数据库操作超时时间
timeout = 5  # 秒为单位

# etcd
[etcd]
service = ["0.0.0.0:2379"]
username = ""
password = ""
dialtimeout = 5000
# etcd kv存储的key前缀 用来与其他业务做区分
prefix = "/gopher_cron"
# 当前节点需要处理的项目ID(先通过service创建项目并获取项目ID)
projects = [1,2]
# 命令调用脚本 /bin/sh  /bin/bash 根据自己系统情况决定
shell = "/bin/bash"

[mysql]
service="0.0.0.0:3306"
username=""
password=""
database=""

client 部署

$ ./gophercron client -c ./config/client-config-default.toml
// 等待如下输入即启动成功 
{"level":"info","msg":"task watcher start","project_id":14,"time":"2020-06-17T18:16:10+08:00"}
{"level":"info","msg":"[agent - TaskKiller] new task killer, project_id: 14","time":"2020-06-17T18:16:10+08:00"}
{"level":"info","msg":"[agent - TaskWatcher] new task watcher, project_id: 14","time":"2020-06-17T18:16:10+08:00"}
{"level":"info","msg":"[agent - Register] new project agent register, project_id: 14","time":"2020-06-17T18:16:10+08:00"}
...

Admin 管理页面

访问地址: localhost:6306/admin

管理员初始账号密码为 admin 123456

image

image

注意

client配置文件中的project配置需要用户先部署service
在service中创建项目后可以获得项目ID
需要将项目ID填写在client的配置中该client才会调度这个项目的任务

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].