目录

在Linux系统上部署xll Job分布式任务调度平台

概述

XXL-JOB是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。

下载

文档地址

源码仓库地址

源码仓库地址Release Download
https://github.com/xuxueli/xxl-jobDownload
http://gitee.com/xuxueli0323/xxl-jobDownload

安装环境

  • Maven3+
  • Jdk1.8+
  • Mysql5.7+

安装 Maven

1
2
yum -y install maven
mvn -v

安装 JDK 1.8+

1
2
yum install java-1.8.0-openjdk* -y
java -version

安装部署

导入数据

将/xxl-job/doc/db/tables_xxl_job.sql导入MySQL数据库:

1
 mysql -uroot -p < tables_xxl_job.sql 

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162900868.png

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162909760.png

修改配置文件

修改admin配置:

1
vim ./xxl-job/xxl-job-admin/src/main/resources/application.properties

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162919134.png

可修改服务端口:

1
server.port=8849

修改数据库连接信息:

1
2
3
4
5
### xxl-job, datasource
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=xxxxxx
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

修改执行器配置:

1
vim ./xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties

可修改服务端口

1
server.port=8848

配置admin链接:

1
2
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl.job.admin.addresses=http://127.0.0.1:8849/xxl-job-admin

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162927938.png

编译

1
mvn package

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162935888.png

编译后生成 2 个 jar 包:

1
./xxl-job/xxl-job-admin/target/xxl-job-admin-2.4.1-SNAPSHOT.jar

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162943291.png

1
./xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/xxl-job-executor-sample-springboot-2.4.1-SNAPSHOT.jar

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162950192.png

运行 jar 包:

1
nohup java -jar xxl-job-admin-2.4.1-SNAPSHOT.jar & &> /dev/null

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921162956428.png

1
nohup java -jar xxl-job-executor-sample-springboot-2.4.1-SNAPSHOT.jar & &> /dev/null

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921163004674.png

测试验证

浏览器输入:http://localhost:ServerPort/xxl-job-admin 默认登录账号为“admin/123456”:

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921163012292.png

Python执行器添加

下载执行器文件:

1
git clone https://github.com/skyfyl/xxl-job-executor-sample-springboot.git

修改admin配置地址后,docker部署:

1
2
3
# 本地编译docker容器或docker pull kobedocker24/xxl-job-executor-sample-springboot
docker build -t xxl-job-executor-sample-springboot:2.2.0 .
docker run -p 8401:8401 -p 8889:8889 -v /root/xxl-job/xxl-job-executor-sample-springboot-master/application.properties:/application.properties --name xxl-job-executor-sample-springboot -d xxl-job-executor-sample-springboot:2.2.0

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921163019690.png

添加执行器

https://21r000-image.oss-cn-shanghai.aliyuncs.com/2023/image-20230921163026363.png