分布式任务调度平台XXL-JOB搭建总结

xxl-job官方网址

源码下载地址

GitHub:https://github.com/xuxueli/xxl-job
码云:https://gitee.com/xuxueli0323/xxl-job

文档地址

中文文档:http://www.xuxueli.com/xxl-job/#/
英文文档:http://www.xuxueli.com/xxl-job/en/#/

源码结构

在这里插入图片描述

初始化脚本

初始化脚本在上面源码目录的 /doc/db/tables_xxl_job.sql ,将此脚本在MySQL数据库中执行一遍。
执行完毕,会在MySQL数据库中生成如下 16 张表:
在这里插入图片描述

配置调度中心

调度中心就是源码中的 xxl-job-admin 工程,我们需要将其配置成自己需要的调度中心,通过该工程我们能够以图形化的方式统一管理任务调度平台上调度任务,负责触发调度执行。

1、修改调度中心配置文件

文件地址:/xxl-job/xxl-job-admin/src/main/resources/xxl-job-admin.properties
配置文件说明:

### 1、调度中心项目的端口号以及访问路径
server.port=8080
server.context-path=/xxl-job-admin

### 2、配置静态文件的前缀
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:/static/

### 3、配置模板文件
spring.freemarker.templateLoaderPath=classpath:/templates/
spring.freemarker.suffix=.ftl
spring.freemarker.charset=UTF-8
spring.freemarker.request-context-attribute=request
spring.freemarker.settings.number_format=0.##########

### 4、配置mybatis的mapper文件地址
mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml

### 5、配置数据库的地址
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl-job?Unicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root_pwd
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
spring.datasource.tomcat.max-wait=10000
spring.datasource.tomcat.max-active=30
spring.datasource.tomcat.test-on-borrow=true
spring.datasource.tomcat.validation-query=SELECT 1
spring.datasource.tomcat.validation-interval=30000

### 6、配置报警邮箱
spring.mail.host=smtp.qq.com
spring.mail.port=25
[email protected]
spring.mail.password=xxx
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true

### 7、管理界面的登录用户名密码
xxl.job.login.username=admin
xxl.job.login.password=123456

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值