GithubHelp home page GithubHelp logo

ddghgf / smallscheduler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dpwgc/smallscheduler

0.0 0.0 0.0 4.47 MB

一个基于Go+MySQL的分布式任务调度平台

Home Page: https://gitee.com/dpwgc/smallscheduler

License: MIT License

Go 98.03% HTML 1.97%

smallscheduler's Introduction

Small Scheduler

一个基于 Go + MySQL 的分布式定时任务调度平台

特点

  • 无状态分布式服务,只依赖 MySQL 数据库,部署流程简单,通过乐观锁控制并发,确保同一时刻同一任务只会被一个服务实例执行
  • 使用HTTP Webhook触发任务,无代码侵入,支持GETPOSTPUTPATCHDELETE方法,支持自定义请求体与请求头
  • 自带网页控制台,可视化配置定时任务,支持设置调度失败重试规则(最大重试次数、重试间隔时间)及备用HTTP调度地址
  • 支持存储与查询各任务的调度记录,按年月划分,自动分表
  • 支持健康检查及平滑关闭服务

index task record process


使用方式

  • 1、编辑项目配置文件 config.yaml,一般只用改数据库配置,其他配置默认即可
  • 2、运行 main.go 或使用 go build main.go 命令将程序编译成可执行文件main/main.exe后,再运行程序
  • 3、访问网页控制台 http://localhost:9088/v1/web/
  • 4、在网页上配置与管理定时任务

将项目源码打包成可执行文件并运行

源代码打包

go build main.go

Mac/Linux环境运行

将可执行文件mainconfig.yaml配置文件、web前端文件夹置于同一目录下

  • 运行目录
    • main
    • config.yaml
    • web
      • css
      • js
      • index.html

cd 到运行目录,执行命令

./main

run

Windows环境运行

将可执行文件main.execonfig.yaml配置文件、web前端文件夹置于同一目录下

  • 运行目录
    • main.exe
    • config.yaml
    • web
      • css
      • js
      • index.html

双击main.exe运行程序


后台接口

实例健康检查接口

GET http://localhost:9088/v1/health

  • 正常情况:HTTP状态码返回200
  • 正在等待关闭服务:HTTP状态码返回400

平滑关闭实例接口

GET http://localhost:9088/v1/shutdown?wait=10

  • 该接口仅限本机调用(只能使用localhost127.0.0.10.0.0.0这三个hostname访问)
  • 参数 wait : 等待关闭时间(单位-秒),必须大于0
  • 调用shutdown接口后,会在等待10秒后关闭该实例,等待期间只会继续执行那些已经在执行过程中的任务,不会再加载新的任务(避免正在运行的任务突然被打断)

smallscheduler's People

Contributors

dpwgc 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.