RuoYi-Vue-Plus (XXL-JOB任务调度中心一:讲解以及启动)

一、概述

官方文档:

分布式任务调度平台XXL-JOB (xuxueli.com)icon-default.png?t=N7T8https://www.xuxueli.com/xxl-job/简单调用流程:

1:调度中心调用--> 2:执行器任务---> 3:执行器返回日志信息和回调结果

二、XXL-JOB表 

1-建表sql

若依项目sql路径 : script/sql/tables_xxl_job.sql

sql文件已经上传,请自行下载。

 

2-表名称功能结介绍
  1. xxl_job_info:任务基本信息表

    存储任务的基本信息,比如任务名、任务描述、任务执行类、Cron 表达式等。
  2. xxl_job_group:执行器组信息表

    用于存储执行器组的信息,包括执行器的名称、地址等。
  3. xxl_job_executor:执行器详细信息表

    记录执行器的详细信息,例如执行器的 IP 地址、执行器名称等。
  4. xxl_job_log:任务执行日志表

    存储任务执行的日志信息,包括执行状态、开始时间、结束时间等。
  5. xxl_job_log_report:执行结果报告。

    统计任务执行的结果报告,用于展示任务执行情况的统计信息。
  6. xxl_job_lock:并发锁信息表

    用于保证并发调度时的唯一性,防止多个调度实例同时执行同一个任务。

 三、后端代码配置

1-pom 需要引入的依赖介绍

spring的web、发送邮件、监控中心、xxl核心包等等

<dependencies>
        <!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- starter-test:junit + spring-test + mockito -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- freemarker-starter :freemarker模版,生成前端代码-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>

        <!-- mail-starter :邮件模块 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>

        <!-- starter-actuator:引入端点 给监控中心监控 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>${spring-boot.mybatis}</version>
        </dependency>

        <!-- mysql -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
        </dependency>

         <!--Spring Boot Admin 的服务器端功能,可以用来监控和管理客户端应用程序-->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>

        <!-- xxl-job-core :任务调度核心包 -->
        <dependency>
            <groupId>com.xuxueli</groupId>
            <artifactId>xxl-job-core</artifactId>
        </dependency>
    </dependencies>
2-框架接介绍

xxl模块是前后端不分离项目:sql位置,前端文件位置如下:

3-项目启动 

 配置application.yml 中端口号:

--- # server 配置
server:
  port: 9100
  servlet:
    context-path: /xxl-job-admin

配置 application-dev.yml 中数据库地址:

--- # 数据库配置
spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/ry-vue-plus?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
    username: root
    password: root

即可直接启动调度中心,启动成功:

端口:9100

上下文:/xxl-job-admin

2024-08-02 11:21:42 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer
 - Tomcat started on port(s): 9100 (http) with context path '/xxl-job-admin'
2024-08-02 11:21:42 [main] INFO  c.x.job.admin.XxlJobAdminApplication
 - Started XxlJobAdminApplication in 4.643 seconds (JVM running for 10.385)
2024-08-02 11:21:46 [xxl-job, admin JobScheduleHelper#scheduleThread] INFO  c.x.j.a.c.thread.JobScheduleHelper
 - >>>>>>>>> init xxl-job admin scheduler success.

所以访问地址跳转登录 :http://localhost:9100/xxl-job-admin :

 

访问成功:

用户名:admin        

密码:123456

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值