Xxl-job安装
在使用xxl-job前,需要进行安装
其中Git地址为:https://github.com/xuxueli/xxl-job
💡 安装前请确保有JDK、Mysql、Maven
步骤1
下载对应的压缩包到linux服务器上,在想要安装的位置进行解压。(也可以下载在windows上,更改下面的配置后通过maven打包成jar包,到服务器上运行)
在目录doc/db 下有创建数据库表的sql文件,进行运行(数据库运行一定在服务器上)
步骤2
修改调度中心配置文件application.properties
💡 路径:xxl-job-admin/src/main/resources/application.properties
配置端口号
server.port=8080
修改数据库信息
spring.datasource.url=jdbc:mysql://deptestxx:3306/xxl-job?Unicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=password
登录的用户名和密码
xxl.job.login.username=admin
xxl.job.login.password=123456
步骤3
修改调度中心logback.xml(配置xxl-job的日志路径)
💡 路径:xxl-job-admin/src/main/resources/logback.xml
日志路径修改
log.path=????
步骤4
修改执行器配置文件application.properties
💡 路径:xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
端口号
xxl-job地址
xxl.job.admin.addresses=http://192.168.x.x:8080/xxl-job-admin
执行器运行日志文件存储磁盘路径
xxl.job.executor.logpath=/usr/local/xxl-job/jobhandler
步骤5
修改执行器logback.xml(配置xxl-job的日志路径)
💡 路径:xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
设置log.path参数为/usr/local/xxl-job/logs/xxl-job-executor-sample-springboot.log
步骤6
进行mvn编译
1、启动调度中心
nohup java -jar xxl-job-admin/target/xxl-job-admin.jar &
2、启动执行器
nohup java -jar xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/xxl-job-executor-sample-springboot.jar &
3、查看守护进程
ps -ef | grep xxl-job