杨梅冲
每天在想什么呢?

官网:https://www.xuxueli.com/xxl-job/

阿里云:https://opendocs.alipay.com/cloud/0998cg?pathHash=ff74f005

github:https://github.com/xuxueli/xxl-job

1.配置

cd xxl-job-2.3.1/doc/db
# 导入数据
mysql -u root -p
source tables_xxl_job.sql

# 修改配置文件
cd xxl-job-2.3.1
vi xxl-job-admin/src/main/resources/application.properties
### web
server.port=8080. # 控制台页面访问端口
server.servlet.context-path=/xxl-job-admin

# 配置数据库IP账号密码
### xxl-job, datasource
spring.datasource.url=jdbc:mysql://192.168.1.10:3307/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=wg1q2w3e

# 配置日志路径
vi xxl-job-admin/src/main/resources/logback.xml
<property name="log.path" value="/usr/local/xxl-job/logs/xxl-job-admin.log"/>

#
vi xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
server.port=8081   # 根据需要修改
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin   # 如果admin改了端口此处也要改
xxl.job.executor.logpath=/usr/local/xxl-job/logs/jobhandler # 执行器运行日志文件存储磁盘路径

# 修改日志路径
vi xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
<property name="log.path" value="/usr/local/xxl-job/logs/xxl-job-executor-sample-springboot.log"/>
### 调度中心JDBC链接:链接地址请保持和 2.1章节 所创建的调度数据库的地址一致
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root_pwd
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
### 报警邮箱
spring.mail.host=smtp.qq.com
spring.mail.port=25
spring.mail.username=xxx@qq.com
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
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
### 调度中心通讯TOKEN [选填]:非空时启用;
xxl.job.accessToken=
### 调度中心国际化配置 [必填]: 默认为 "zh_CN"/中文简体, 可选范围为 "zh_CN"/中文简体, "zh_TC"/中文繁体 and "en"/英文;
xxl.job.i18n=zh_CN
## 调度线程池最大线程配置【必填】
xxl.job.triggerpool.fast.max=200
xxl.job.triggerpool.slow.max=100
### 调度中心日志表数据保存天数 [必填]:过期日志自动清理;限制大于等于7时生效,否则, 如-1,关闭自动清理功能;
xxl.job.logretentiondays=30
application.properties

2.编译

yum -y install jdk* # 根据需求安装版本
yum install maven -y

cd xxl-job-2.3.1
mvn package

编译成功:
[INFO] xxl-job ........................................... SUCCESS [0.002s]
[INFO] xxl-job-core ...................................... SUCCESS [39:00.372s]
[INFO] xxl-job-admin ..................................... SUCCESS [30:28.600s]
[INFO] xxl-job-executor-samples .......................... SUCCESS [0.001s]
[INFO] xxl-job-executor-sample-frameless ................. SUCCESS [6.980s]
[INFO] xxl-job-executor-sample-springboot ................ SUCCESS [1.020s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:09:37.360s
[INFO] Finished at: Thu Jun 27 12:17:09 CST 2024
[INFO] Final Memory: 57M/303M
[INFO] ------------------------------------------------------------------------

success 就成功了

3.启动

#nohup java -jar xxl-job-admin/target/xxl-job-admin-2.3.1.jar > /dev/null 2> /dev/null &
 
#nohup java -jar xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/xxl-job-executor-sample-springboot-2.3.1.jar > /dev/null 2> /dev/null &

 

访问:http://10.1.1.101:8080/xxl-job-admin/

4.集群部署

https://www.xuxueli.com/xxl-job/ 

 

posted on 2024-06-27 13:30  杨梅冲  阅读(91)  评论(0编辑  收藏  举报