mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-04 11:37:28 +00:00
update 任务调度 独立 ruoyi-job 服务 统一远程处理任务 规范用法
This commit is contained in:
@@ -9,7 +9,7 @@ datasource:
|
||||
url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: password
|
||||
xxl-job-admin:
|
||||
job:
|
||||
url: jdbc:mysql://localhost:3306/ry-job?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: password
|
||||
|
41
config/dev/ruoyi-job.yml
Normal file
41
config/dev/ruoyi-job.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# dubbo 订阅配置
|
||||
dubbo:
|
||||
cloud:
|
||||
# 需要远程调用的服务 多个用逗号分割
|
||||
subscribed-services: ruoyi-system
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
dynamic:
|
||||
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||
primary: master
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: ${datasource.job.url}
|
||||
username: ${datasource.job.username}
|
||||
password: ${datasource.job.password}
|
||||
|
||||
xxl:
|
||||
job:
|
||||
# 执行器开关
|
||||
enabled: true
|
||||
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||
admin-addresses: http://localhost:9900
|
||||
# 执行器通讯TOKEN:非空时启用
|
||||
access-token: xxl-job
|
||||
# 执行器配置
|
||||
executor:
|
||||
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
appname: ${spring.application.name}-executor
|
||||
# 执行器端口号 执行器从19901开始往后写
|
||||
port: 9901
|
||||
# 执行器注册:默认IP:PORT
|
||||
address:
|
||||
# 执行器IP:默认自动获取IP
|
||||
ip:
|
||||
# 执行器运行日志文件存储磁盘路径
|
||||
logpath: ./logs/${spring.application.name}/xxl-job
|
||||
# 执行器日志文件保存天数:大于3生效
|
||||
logretentiondays: 30
|
@@ -22,26 +22,3 @@ spring:
|
||||
# url:
|
||||
# username:
|
||||
# password:
|
||||
|
||||
xxl:
|
||||
job:
|
||||
# 执行器开关
|
||||
enabled: true
|
||||
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||
admin-addresses: http://localhost:9900
|
||||
# 执行器通讯TOKEN:非空时启用
|
||||
access-token: xxl-job
|
||||
# 执行器配置
|
||||
executor:
|
||||
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
appname: ${spring.application.name}-executor
|
||||
# 执行器端口号 执行器从19901开始往后写
|
||||
port: 9901
|
||||
# 执行器注册:默认IP:PORT
|
||||
address:
|
||||
# 执行器IP:默认自动获取IP
|
||||
ip:
|
||||
# 执行器运行日志文件存储磁盘路径
|
||||
logpath: ./logs/${spring.application.name}/xxl-job
|
||||
# 执行器日志文件保存天数:大于3生效
|
||||
logretentiondays: 30
|
||||
|
@@ -3,9 +3,9 @@ spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: ${datasource.xxl-job-admin.url}
|
||||
username: ${datasource.xxl-job-admin.username}
|
||||
password: ${datasource.xxl-job-admin.password}
|
||||
url: ${datasource.job.url}
|
||||
username: ${datasource.job.username}
|
||||
password: ${datasource.job.password}
|
||||
hikari:
|
||||
auto-commit: true
|
||||
connection-test-query: SELECT 1
|
||||
|
@@ -2,6 +2,7 @@ service.vgroupMapping.ruoyi-auth-group=default
|
||||
service.vgroupMapping.ruoyi-system-group=default
|
||||
service.vgroupMapping.ruoyi-resource-group=default
|
||||
service.vgroupMapping.ruoyi-gen-group=default
|
||||
service.vgroupMapping.ruoyi-job-group=default
|
||||
service.enableDegrade=false
|
||||
service.disableGlobalTransaction=false
|
||||
store.mode=db
|
||||
|
@@ -12,7 +12,7 @@ services:
|
||||
# 初始化数据库
|
||||
MYSQL_DATABASE: ry-cloud
|
||||
ports:
|
||||
- 3306:3306
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
# 数据挂载
|
||||
- /docker/mysql/data/:/var/lib/mysql/
|
||||
@@ -35,9 +35,9 @@ services:
|
||||
image: nacos/nacos-server:2.0.4
|
||||
container_name: nacos
|
||||
ports:
|
||||
- 8848:8848
|
||||
- 9848:9848
|
||||
- 9849:9849
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
- "9849:9849"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MODE: standalone
|
||||
@@ -61,7 +61,7 @@ services:
|
||||
image: redis:6.2.6
|
||||
container_name: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
- "6379:6379"
|
||||
environment:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
@@ -82,9 +82,9 @@ services:
|
||||
container_name: minio
|
||||
ports:
|
||||
# api 端口
|
||||
- 9000:9000
|
||||
- "9000:9000"
|
||||
# 控制台端口
|
||||
- 9001:9001
|
||||
- "9001:9001"
|
||||
environment:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
@@ -108,7 +108,7 @@ services:
|
||||
image: seataio/seata-server:1.4.2
|
||||
container_name: seata-server
|
||||
ports:
|
||||
- 8091:8091
|
||||
- "8091:8091"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
# 注意 此处ip如果是外网使用 要改为外网ip
|
||||
@@ -131,8 +131,8 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
# 证书映射
|
||||
- /docker/nginx/cert:/etc/nginx/cert
|
||||
@@ -153,7 +153,7 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 8718:8718
|
||||
- "8718:8718"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-sentinel-dashboard/logs/:/ruoyi/sentinel-dashboard/logs
|
||||
@@ -169,7 +169,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9100:9100
|
||||
- "9100:9100"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-monitor/logs/:/ruoyi/monitor/logs
|
||||
@@ -186,7 +186,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9900:9900
|
||||
- "9900:9900"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-xxl-job-admin/logs/:/ruoyi/xxl-job-admin/logs
|
||||
@@ -203,7 +203,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 8080:8080
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-gateway/logs/:/ruoyi/gateway/logs
|
||||
@@ -220,7 +220,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9200:9200
|
||||
- "9200:9200"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-auth/logs/:/ruoyi/auth/logs
|
||||
@@ -237,7 +237,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9201:9201
|
||||
- "9201:9201"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-system/logs/:/ruoyi/system/logs
|
||||
@@ -246,6 +246,38 @@ services:
|
||||
networks:
|
||||
- ruoyi_net
|
||||
|
||||
ruoyi-gen:
|
||||
image: ruoyi/ruoyi-gen:0.7.0
|
||||
container_name: ruoyi-gen
|
||||
environment:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "9202:9202"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-gen/logs/:/ruoyi/gen/logs
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- ruoyi_net
|
||||
|
||||
ruoyi-job:
|
||||
image: ruoyi/ruoyi-job:0.7.0
|
||||
container_name: ruoyi-job
|
||||
environment:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "9203:9203"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-job/logs/:/ruoyi/job/logs
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- ruoyi_net
|
||||
|
||||
ruoyi-resource:
|
||||
image: ruoyi/ruoyi-resource:0.7.0
|
||||
container_name: ruoyi-resource
|
||||
@@ -253,7 +285,7 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9300:9300
|
||||
- "9300:9300"
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/ruoyi-resource/logs/:/ruoyi/resource/logs
|
||||
|
@@ -11,6 +11,7 @@
|
||||
<modules>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-gen</module>
|
||||
<module>ruoyi-job</module>
|
||||
<module>ruoyi-resource</module>
|
||||
</modules>
|
||||
|
||||
|
15
ruoyi-modules/ruoyi-job/Dockerfile
Normal file
15
ruoyi-modules/ruoyi-job/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||
|
||||
MAINTAINER Lion Li
|
||||
|
||||
RUN mkdir -p /ruoyi/job
|
||||
RUN mkdir -p /ruoyi/job/logs
|
||||
RUN mkdir -p /ruoyi/job/temp
|
||||
|
||||
WORKDIR /ruoyi/job
|
||||
|
||||
EXPOSE 9203
|
||||
|
||||
ADD ./target/ruoyi-job.jar ./app.jar
|
||||
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
116
ruoyi-modules/ruoyi-job/pom.xml
Normal file
116
ruoyi-modules/ruoyi-job/pom.xml
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>0.7.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-job</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-job 任务调度模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-dict</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Api System -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.job;
|
||||
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 任务调度模块
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class RuoYiJobApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuoYiJobApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 任务调度模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.job.service;
|
||||
|
||||
import com.ruoyi.system.api.RemoteUserService;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* XxlJob 多服务调用
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MultiService {
|
||||
|
||||
@DubboReference
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 多服务调用
|
||||
*/
|
||||
@GlobalTransactional(rollbackFor = Exception.class)
|
||||
@XxlJob("multiServiceHandler")
|
||||
public void multiServiceHandler() throws Exception {
|
||||
LoginUser admin = remoteUserService.getUserInfo("admin");
|
||||
XxlJobHelper.log("XXL-JOB, multiServiceHandler result: {}", admin.toString());
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName("test");
|
||||
sysUser.setNickName("test");
|
||||
remoteUserService.registerUserInfo(sysUser);
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.system.job;
|
||||
package com.ruoyi.job.service;
|
||||
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
10
ruoyi-modules/ruoyi-job/src/main/resources/banner.txt
Normal file
10
ruoyi-modules/ruoyi-job/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
_ _ _
|
||||
(_) (_) | |
|
||||
_ __ _ _ ___ _ _ _ ______ _ ___ | |__
|
||||
| '__| | | |/ _ \| | | | |______| |/ _ \| '_ \
|
||||
| | | |_| | (_) | |_| | | | | (_) | |_) |
|
||||
|_| \__,_|\___/ \__, |_| | |\___/|_.__/
|
||||
__/ | _/ |
|
||||
|___/ |__/
|
38
ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml
Normal file
38
ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9203
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
# 此配置禁止放入 nacos 优先级不够
|
||||
allow-circular-references: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: ruoyi-job
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: @profiles.active@
|
||||
|
||||
--- # nacos 配置
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# nacos 服务地址
|
||||
server-addr: @nacos.server@
|
||||
discovery:
|
||||
# 注册组
|
||||
group: @nacos.discovery.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
config:
|
||||
# 配置组
|
||||
group: @nacos.config.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- data-id: application.${spring.cloud.nacos.config.file-extension}
|
||||
refresh: true
|
||||
- data-id: datasource.${spring.cloud.nacos.config.file-extension}
|
||||
refresh: true
|
97
ruoyi-modules/ruoyi-job/src/main/resources/logback.xml
Normal file
97
ruoyi-modules/ruoyi-job/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/ruoyi-job" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="console.log.pattern"
|
||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${console.log.pattern}</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/console.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/console.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大 1天 -->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
<appender-ref ref="file_console" />
|
||||
</root>
|
||||
</configuration>
|
@@ -84,11 +84,6 @@
|
||||
<artifactId>ruoyi-common-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Api System -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
|
@@ -110,10 +110,26 @@ CREATE TABLE `xxl_job_lock` (
|
||||
PRIMARY KEY (`lock_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'ruoyi-system-executor', '示例执行器', 0, NULL, '2018-11-03 22:21:31' );
|
||||
INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'ruoyi-job-executor', '示例执行器', 0, NULL, '2018-11-03 22:21:31' );
|
||||
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '');
|
||||
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (2, 1, '多服务任务', '2022-02-17 12:21:31', '2022-02-17 12:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'multiServiceHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2022-02-17 12:21:31', '');
|
||||
INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
|
||||
INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock');
|
||||
|
||||
-- for AT mode you must to init this sql for you business database. the seata server not need it.
|
||||
CREATE TABLE IF NOT EXISTS `undo_log`
|
||||
(
|
||||
`branch_id` BIGINT(20) NOT NULL COMMENT 'branch transaction id',
|
||||
`xid` VARCHAR(100) NOT NULL COMMENT 'global transaction id',
|
||||
`context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
|
||||
`rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
|
||||
`log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status',
|
||||
`log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
|
||||
`log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
|
||||
UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='AT transaction mode undo table';
|
||||
|
||||
commit;
|
||||
|
||||
|
Reference in New Issue
Block a user