Giter Site home page Giter Site logo

elasticgocron's Introduction

项目背景

本项目fork于项目https://github.com/ouqiang/gocron。

二次开发的目的

  • gocron的调度器仅支持单机部署,有单点风险。本项目将调度器从单点改造为分布式部署,调度器分为master主节点和副本duplicate节点。
  • 主节点负责任务调度,副本节点仅提供备份。
  • 单独的哨兵服务监控主节点服务状态,出现异常情况,下线主节点,选举副本节点为主节点负责任务调度,实现调度器的高可用。

gocron - 定时任务管理系统

Downloads license Release

项目简介

使用Go语言开发的轻量级定时任务集中调度和管理系统, 用于替代Linux-crontab 查看文档

原有的延时任务拆分为独立项目延迟队列

功能特性

  • Web界面管理定时任务
  • crontab时间表达式, 精确到秒
  • 任务执行失败可重试
  • 任务执行超时, 强制结束
  • 任务依赖配置, A任务完成后再执行B任务
  • 账户权限控制
  • 任务类型
    • shell任务

    在任务节点上执行shell命令, 支持任务同时在多个节点上运行

    • HTTP任务

    访问指定的URL地址, 由调度器直接执行, 不依赖任务节点

  • 查看任务执行结果日志
  • 任务执行结果通知, 支持邮件、Slack、Webhook

截图

流程图 任务 Slack

支持平台

Windows、Linux、Mac OS

环境要求

MySQL

下载

安装

二进制安装

  1. 解压压缩包  
  2. cd 解压目录
  3. 启动
  • 调度器启动
    • Windows: gocron.exe web
    • Linux、Mac OS: ./gocron web
  • 任务节点启动, 默认监听0.0.0.0:5921
    • Windows: gocron-node.exe
    • Linux、Mac OS: ./gocron-node
  1. 浏览器访问 http://localhost:5920

源码安装

  • 安装Go 1.11+
  • go get -d github.com/brookwang/ElasticGocron
  • export GO111MODULE=on
  • 编译 make
  • 启动
    • 调度器主节点 gocron ./bin/gocron web --role master
    • 调度器副本节点 gocron ./bin/gocron web
    • 执行器 gocron-node ./bin/gocron-node

开发

  1. 安装Go1.9+, Node.js, Yarn
  2. 安装前端依赖 make install-vue
  3. 启动gocron, gocron-node make run
  4. 启动node server make run-vue, 访问地址 http://localhost:8080

访问http://localhost:8080, API请求会转发给gocron

make 编译

make run 编译并运行

make package 打包

生成当前系统的压缩包 gocron-v1.5-darwin-amd64.tar.gz gocron-node-v1.5-darwin-amd64.tar.gz

make package-all 生成Windows、Linux、Mac的压缩包

命令

  • gocron

    • -v 查看版本
  • gocron web

    • --host 默认0.0.0.0
    • --role 指定调度器角色, master|duplicate, master为主节点, duplicate为副本节点,默认duplicate
    • -p 端口, 指定端口, 默认5920
    • -e 指定运行环境, dev|test|prod, dev模式下可查看更多日志信息, 默认prod
    • -h 查看帮助
  • gocron-node

    • -allow-root *nix平台允许以root用户运行
    • -s ip:port 监听地址
    • -enable-tls 开启TLS
    • -ca-file   CA证书文件  
    • -cert-file 证书文件
    • -key-file 私钥文件
    • -h 查看帮助
    • -v 查看版本

To Do List

  • 版本升级
  • 批量开启、关闭、删除任务
  • 调度器与任务节点通信支持https
  • 任务分组
  • 多用户
  • 权限控制

程序使用的组件

反馈

ChangeLog

elasticgocron's People

Contributors

aspirewit avatar brookwang avatar chaiyd avatar eamonzhang avatar feiin avatar fromiuan avatar ouqiang avatar zhangqiusheng avatar zhmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.