XXL JOB DockerCompose部署

server/2024/11/19 16:29:28/

官网给的方式是 Docker 命令启动,但是用起来太麻烦了,所以用DockerCompose 简化部署

创建数据库,导入 SQL

SQL 脚本位置为/xxl-job/doc/db/tables_xxl_job.sql

https://raw.githubusercontent.com/xuxueli/xxl-job/refs/heads/master/doc/db/tables_xxl_job.sql

编写 DockerCompose

version: '3.7'
services:xxl-job:image: registry.cn-shanghai.aliyuncs.com/frbbs/xxl-job-admin:2.4.1container_name: xxl-job-adminrestart: alwaysports:- "8080:8080"volumes:- ./application.yml:/config/application.yml:ro- /data/logs/xxl-job:/data/applogs

为了方便配置的修改,将配置独立成application.yml 了

编写 application.yml 配置

spring:datasource:url: jdbc:mysql://xxxx:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghaiusername: xxl_jobpassword: xxxdriver-class-name: com.mysql.jdbc.Driver
xxl:job:accessToken: xxxx

调度中心配置内容说明:

### 调度中心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

启动

docker-compose up -d && docker-compose logs -fxxl-job-admin  | 
xxl-job-admin  |   .   ____          _            __ _ _
xxl-job-admin  |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
xxl-job-admin  | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
xxl-job-admin  |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
xxl-job-admin  |   '  |____| .__|_| |_|_| |_\__, | / / / /
xxl-job-admin  |  =========|_|==============|___/=/_/_/_/
xxl-job-admin  |  :: Spring Boot ::               (v2.7.18)
xxl-job-admin  |
xxl-job-admin  | 16:59:05.886 logback [main] INFO  c.x.job.admin.XxlJobAdminApplication - Starting XxlJobAdminApplication using Java 1.8.0_332 on 1a5e48b76b08 with PID 7 (/app.jar started by root in /)
xxl-job-admin  | 16:59:05.888 logback [main] INFO  c.x.job.admin.XxlJobAdminApplication - No active profile set, falling back to 1 default profile: "default"
xxl-job-admin  | 16:59:06.716 logback [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
xxl-job-admin  | 16:59:06.720 logback [main] INFO  o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
xxl-job-admin  | 16:59:06.722 logback [main] INFO  o.a.catalina.core.StandardService - Starting service [Tomcat]
xxl-job-admin  | 16:59:06.722 logback [main] INFO  o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.83]
xxl-job-admin  | 16:59:06.802 logback [main] INFO  o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring embedded WebApplicationContext
xxl-job-admin  | 16:59:06.802 logback [main] INFO  o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 749 ms
xxl-job-admin  | Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
xxl-job-admin  | 16:59:07.157 logback [main] INFO  c.x.j.a.c.scheduler.XxlJobScheduler - >>>>>>>>> init xxl-job admin success.
xxl-job-admin  | 16:59:07.168 logback [xxl-job, admin JobFailMonitorHelper] INFO  com.zaxxer.hikari.HikariDataSource - HikariCP - Starting...
xxl-job-admin  | 16:59:07.170 logback [xxl-job, admin JobFailMonitorHelper] WARN  c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.       
xxl-job-admin  | 16:59:07.288 logback [main] INFO  o.s.b.a.w.s.WelcomePageHandlerMapping - Adding welcome page template: index
xxl-job-admin  | 16:59:07.581 logback [main] INFO  o.s.b.a.e.web.EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
xxl-job-admin  | 16:59:07.594 logback [main] INFO  o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
xxl-job-admin  | 16:59:07.605 logback [main] INFO  o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring DispatcherServlet 'dispatcherServlet'
xxl-job-admin  | 16:59:07.606 logback [main] INFO  o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
xxl-job-admin  | 16:59:07.607 logback [main] INFO  o.s.web.servlet.DispatcherServlet - Completed initialization in 1 ms
xxl-job-admin  | 16:59:07.607 logback [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path '/xxl-job-admin'
xxl-job-admin  | 16:59:07.615 logback [main] INFO  c.x.job.admin.XxlJobAdminApplication - Started XxlJobAdminApplication in 1.973 seconds (JVM running for 2.393)
xxl-job-admin  | 16:59:07.692 logback [xxl-job, admin JobFailMonitorHelper] INFO  com.zaxxer.hikari.HikariDataSource - HikariCP - Start completed.
xxl-job-admin  | 16:59:12.000 logback [xxl-job, admin JobScheduleHelper#scheduleThread] INFO  c.x.j.a.c.thread.JobScheduleHelper - >>>>>>>>> init xxl-job admin scheduler success.
xxl-job-admin  | 16:59:41.367 logback [http-nio-8080-exec-1] INFO  o.a.tomcat.util.http.parser.Cookie - A cookie header was received [Hm_lvt_c081e53834443c7768dc0a2f554ab0b9=1728542906,1729482490,1730871693,1731034126;] that contained an invalid cookie. That cookie will be ignored.

如果没有报错的话,就是部署完成了;如果要升级,只需要修改 DockerCompose 配置的版本号即可

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

本文由博客一文多发平台 OpenWrite 发布!


http://www.ppmy.cn/server/143236.html

相关文章

JDK自带JVM工具

1.jps查看当前java线程 2.jmap查看当前堆信息 要看18232的堆栈信息:jmap -heap 18232 将堆信息存快照文件:jmap -dump:formatb,fileheapDump 18232 查看堆快照文件内容 jhat -port 8077 heapDump 该命令将会启动一个服务将快照文件进行解析&#xff…

电脑Vs台式机 (后续还有)

性能方面: 处理器性能:在相同配置参数下,台式机的处理器性能发挥通常更出色。这是因为台式机的散热条件更好,处理器可以在更稳定的温度下工作,不用担心过热降频等问题。例如,在进行视频编辑、3D 建模等高强…

SQL Server中,CONVERT函数转换日期

在SQL Server中,CONVERT函数支持多种样式代码(style codes),用于指定日期和时间的格式。样式代码 23 是一种常用的格式,表示 yyyy-mm-dd。以下是一些常用的样式代码: 日期格式样式代码 0 or 100 - mon dd…

Go语言跨平台桌面应用开发新纪元:LCL、CEF与Webview全解析

开篇寄语 在Go语言的广阔生态中,桌面应用开发一直是一个备受关注的领域。今天,我将为大家介绍三款基于Go语言的跨平台桌面应用开发框架——LCL、CEF与Webview,它们分别拥有独特的魅力和广泛的应用场景。通过这三款框架,你将能够轻…

hhdb数据库介绍(9-18)

Oracle兼容性说明 数据类型兼容 本节主要介绍 HHDB Server与Oracle 数据库中数据类型的详细兼容对比信息。 比较项Oracle数据库数据类型HHDB Server数据类型对应项/替代项字符串/字符VARCHAR2( n )VARCHAR( n )字符串/字符NVARCHAR2( n )VARCHAR( n ) character set utf8字符…

聚类算法总结

一、引言 聚类分析是数据挖掘、机器学习等领域中的重要任务,旨在将数据集中相似的数据对象划分到同一组(簇)中。聚类算法无需事先知道数据的类别标签,是一种无监督学习方法。它在许多应用场景中发挥了关键作用,例如客…

React 教程第一节 简介概述 以及 特点

概述: 一个用于构建web与原生交互界面的UI库,无论是独立开发者,还是团队协作,React 都可以轻松的组合由不同人群开发的组件,随写随插随用,方便快捷; 特点: 1、声明式设计&#xf…

RLC串联电路基础

RLC串联电路 一、电路基本构成与方程 RLC串联电路由电阻(R)、电感(L)和电容(C)串联组成。其描述行为的二阶微分方程为 L d 2 i d t 2 R d i d t 1 C i 0 L\frac{d^{2}i}{dt^{2}} R\frac{di}{dt} \fr…