PowerJob服务端部署

本文来编写一个简单的实例来说下SpringBoot整合PowerJob


相关文档

PowerJob是一个定时任务中间件(框架),优点很多,PowerJob官网的对比图中可以看到PowerJob比Quartz、XXL-JOB等更加优秀

官网http://www.powerjob.tech/
文档https://www.yuque.com/powerjob/guidence/intro
快速开始https://www.yuque.com/powerjob/guidence/quick_start
githubhttps://github.com/PowerJob/PowerJob

在这里插入图片描述


快速开始

PowerJob由调度服务器(powerjob-server)和执行器(powerjob-worker)两部分组成,powerjob-server负责提供Web服务和完成任务的调度,powerjob-worker则负责执行用户所编写的任务代码,同时提供分布式计算能力。

在这里插入图片描述


初始化项目

git clone https://github.com/KFCFans/PowerJob.git

在这里插入图片描述

导入 IDE,源码结构如下,我们需要启动调度服务器(powerjob-server),同时在 samples 工程中编写自己的处理器代码

在这里插入图片描述


启动服务端

创建数据库(仅需要创建数据库):

CREATE DATABASE IF NOT EXISTS `powerjob-daily` DEFAULT CHARSET utf8mb4

修改配置文件

在这里插入图片描述

配置文件的说明:官方文档写的非常详细,此处不再赘述。本处我的配置为:

oms.env=DAILY
logging.config=classpath:logback-dev.xml

####### Database properties(Configure according to the the environment) #######
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-daily?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.core.username=root
#spring.datasource.core.password=No1Bug2Please3!
spring.datasource.core.password=root
spring.datasource.core.maximum-pool-size=20
spring.datasource.core.minimum-idle=5

####### MongoDB properties(Non-core configuration properties)  #######
####### delete mongodb config to disable mongodb #######
oms.mongodb.enable=false
#spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority

####### Email properties(Non-core configuration properties) #######
####### Delete the following code to disable the mail #######
#spring.mail.host=smtp.163.com
#spring.mail.username=zqq@163.com
#spring.mail.password=GOFZPNARMVKCGONV
#spring.mail.properties.mail.smtp.auth=true
#spring.mail.properties.mail.smtp.starttls.enable=true
#spring.mail.properties.mail.smtp.starttls.required=true

####### DingTalk properties(Non-core configuration properties) #######
####### Delete the following code to disable the DingTalk #######
#oms.alarm.ding.app-key=dingauqwkvxxnqskknfv
#oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl
#oms.alarm.ding.agent-id=847044348

####### Resource cleaning properties #######
oms.instanceinfo.retention=1
oms.container.retention.local=1
oms.container.retention.remote=-1

####### Cache properties #######
oms.instance.metadata.cache.size=1024

####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
####### split-brain could be avoided while performance overhead would increase. #######
oms.accurate.select.server.percentage = 50

启动服务

启动此类:tech.powerjob.server.PowerJobServerApplication

在这里插入图片描述


注册应用

访问:[http://127.0.0.1:7700/]

在这里插入图片描述

登录

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值