mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 10:35:57 +08:00
对接powerjob替换xxl-job实现分布式任务调度
This commit is contained in:
parent
eab7ecfb3a
commit
a9bfbaf241
14
pom.xml
14
pom.xml
@ -34,7 +34,7 @@
|
||||
<lock4j.version>2.2.4</lock4j.version>
|
||||
<dynamic-ds.version>3.6.1</dynamic-ds.version>
|
||||
<alibaba-ttl.version>2.14.2</alibaba-ttl.version>
|
||||
<powerjob.version>4.3.2</powerjob.version>
|
||||
<powerjob.version>4.3.3</powerjob.version>
|
||||
<mapstruct-plus.version>1.2.3</mapstruct-plus.version>
|
||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
@ -329,6 +329,18 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- PowerJob -->
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
|
||||
<version>${powerjob.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-official-processors</artifactId>
|
||||
<version>${powerjob.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
<module>ruoyi-common-doc</module>
|
||||
<module>ruoyi-common-excel</module>
|
||||
<module>ruoyi-common-idempotent</module>
|
||||
<module>ruoyi-common-job</module>
|
||||
<module>ruoyi-common-log</module>
|
||||
<module>ruoyi-common-mail</module>
|
||||
<module>ruoyi-common-mybatis</module>
|
||||
|
||||
@ -47,6 +47,13 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 调度模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-job</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 日志记录 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
|
||||
46
ruoyi-common/ruoyi-common-job/pom.xml
Normal file
46
ruoyi-common/ruoyi-common-job/pom.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?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>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-common-job</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-job 定时任务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--PowerJob-->
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-official-processors</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,6 +1,7 @@
|
||||
package org.dromara.job.config;
|
||||
package org.dromara.common.job.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import tech.powerjob.worker.PowerJobWorker;
|
||||
@ -12,8 +13,9 @@ import tech.powerjob.worker.PowerJobWorker;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(PowerJobWorker.class)
|
||||
@ConditionalOnProperty(prefix = "powerjob.worker", name = "enabled", havingValue = "true")
|
||||
@EnableScheduling
|
||||
public class PowerJobConfiguration {
|
||||
public class PowerJobConfig {
|
||||
|
||||
|
||||
}
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-monitor-admin</module>
|
||||
<module>ruoyi-powerjob-server</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
||||
63
ruoyi-extend/ruoyi-powerjob-server/pom.xml
Normal file
63
ruoyi-extend/ruoyi-powerjob-server/pom.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-extend</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-powerjob-server</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<spring-boot.version>2.7.4</spring-boot.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- PowerJob server-->
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-server-starter</artifactId>
|
||||
<version>${powerjob.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</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>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,45 @@
|
||||
package org.dromara.powerjob.server;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import tech.powerjob.server.PowerJobServerApplication;
|
||||
import tech.powerjob.server.common.utils.PropertyUtils;
|
||||
|
||||
/**
|
||||
* Admin 监控启动程序
|
||||
*
|
||||
* @author yhan219
|
||||
*/
|
||||
@Slf4j
|
||||
@EnableScheduling
|
||||
@SpringBootApplication(scanBasePackages = "tech.powerjob.server")
|
||||
public class RuoyiPowerJobServerApplication {
|
||||
|
||||
private static final String TIPS = "\n\n" +
|
||||
"******************* PowerJob Tips *******************\n" +
|
||||
"如果应用无法启动,我们建议您仔细阅读以下文档来解决:\n" +
|
||||
"if server can't startup, we recommend that you read the documentation to find a solution:\n" +
|
||||
"https://www.yuque.com/powerjob/guidence/problem\n" +
|
||||
"******************* PowerJob Tips *******************\n\n";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
pre();
|
||||
|
||||
// Start SpringBoot application.
|
||||
try {
|
||||
SpringApplication.run(PowerJobServerApplication.class, args);
|
||||
} catch (Throwable t) {
|
||||
log.error(TIPS);
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
private static void pre() {
|
||||
log.info(TIPS);
|
||||
PropertyUtils.init();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
oms.env=DAILY
|
||||
logging.config=classpath:logback-dev.xml
|
||||
|
||||
####### Database properties(Configure according to the the environment) #######
|
||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.core.username=root
|
||||
spring.datasource.core.password=root
|
||||
spring.datasource.core.maximum-pool-size=20
|
||||
spring.datasource.core.minimum-idle=5
|
||||
|
||||
####### MongoDB properties(Non-core configuration properties) #######
|
||||
####### delete mongodb config to disable mongodb #######
|
||||
#oms.mongodb.enable=true
|
||||
#spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority
|
||||
|
||||
####### Email properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the mail #######
|
||||
#spring.mail.host=smtp.163.com
|
||||
#spring.mail.username=zqq@163.com
|
||||
#spring.mail.password=GOFZPNARMVKCGONV
|
||||
#spring.mail.properties.mail.smtp.auth=true
|
||||
#spring.mail.properties.mail.smtp.starttls.enable=true
|
||||
#spring.mail.properties.mail.smtp.starttls.required=true
|
||||
|
||||
####### DingTalk properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the DingTalk #######
|
||||
#oms.alarm.ding.app-key=dingauqwkvxxnqskknfv
|
||||
#oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl
|
||||
#oms.alarm.ding.agent-id=847044348
|
||||
|
||||
####### Resource cleaning properties #######
|
||||
oms.instanceinfo.retention=1
|
||||
oms.container.retention.local=1
|
||||
oms.container.retention.remote=-1
|
||||
|
||||
####### Cache properties #######
|
||||
oms.instance.metadata.cache.size=1024
|
||||
|
||||
####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
|
||||
####### split-brain could be avoided while performance overhead would increase. #######
|
||||
oms.accurate.select.server.percentage = 50
|
||||
@ -0,0 +1,42 @@
|
||||
oms.env=PRE
|
||||
logging.config=classpath:logback-product.xml
|
||||
|
||||
####### Database properties(Configure according to the the environment) #######
|
||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.core.jdbc-url=jdbc:mysql://remotehost:3306/powerjob-pre?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.core.username=root
|
||||
spring.datasource.core.password=No1Bug2Please3!
|
||||
spring.datasource.core.maximum-pool-size=20
|
||||
spring.datasource.core.minimum-idle=5
|
||||
|
||||
####### MongoDB properties(Non-core configuration properties) #######
|
||||
####### delete mongodb config to disable mongodb #######
|
||||
oms.mongodb.enable=true
|
||||
spring.data.mongodb.uri=mongodb://remotehost:27017/powerjob-pre
|
||||
|
||||
####### Email properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the mail #######
|
||||
spring.mail.host=smtp.qq.com
|
||||
spring.mail.username=zqq
|
||||
spring.mail.password=qqz
|
||||
spring.mail.properties.mail.smtp.auth=true
|
||||
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||
spring.mail.properties.mail.smtp.starttls.required=true
|
||||
|
||||
####### DingTalk properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the DingTalk #######
|
||||
oms.alarm.ding.app-key=dingauqwkvxxnqskknfv
|
||||
oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl
|
||||
oms.alarm.ding.agent-id=847044348
|
||||
|
||||
####### Resource cleaning properties #######
|
||||
oms.instanceinfo.retention=3
|
||||
oms.container.retention.local=3
|
||||
oms.container.retention.remote=-1
|
||||
|
||||
####### Cache properties #######
|
||||
oms.instance.metadata.cache.size=1024
|
||||
|
||||
####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
|
||||
####### split-brain could be avoided while performance overhead would increase. #######
|
||||
oms.accurate.select.server.percentage = 50
|
||||
@ -0,0 +1,42 @@
|
||||
oms.env=PRODUCT
|
||||
logging.config=classpath:logback-product.xml
|
||||
|
||||
####### Database properties(Configure according to the the environment) #######
|
||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-product?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.core.username=root
|
||||
spring.datasource.core.password=No1Bug2Please3!
|
||||
spring.datasource.core.maximum-pool-size=20
|
||||
spring.datasource.core.minimum-idle=5
|
||||
|
||||
####### MongoDB properties(Non-core configuration properties) #######
|
||||
####### delete mongodb config to disable mongodb #######
|
||||
oms.mongodb.enable=true
|
||||
spring.data.mongodb.uri=mongodb://localhost:27017/powerjob-product
|
||||
|
||||
####### Email properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the mail #######
|
||||
spring.mail.host=smtp.qq.com
|
||||
spring.mail.username=zqq
|
||||
spring.mail.password=qqz
|
||||
spring.mail.properties.mail.smtp.auth=true
|
||||
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||
spring.mail.properties.mail.smtp.starttls.required=true
|
||||
|
||||
####### DingTalk properties(Non-core configuration properties) #######
|
||||
####### Delete the following code to disable the DingTalk #######
|
||||
oms.alarm.ding.app-key=
|
||||
oms.alarm.ding.app-secret=
|
||||
oms.alarm.ding.agent-id=
|
||||
|
||||
####### Resource cleaning properties #######
|
||||
oms.instanceinfo.retention=7
|
||||
oms.container.retention.local=7
|
||||
oms.container.retention.remote=-1
|
||||
|
||||
####### Cache properties #######
|
||||
oms.instance.metadata.cache.size=2048
|
||||
|
||||
####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
|
||||
####### split-brain could be avoided while performance overhead would increase. #######
|
||||
oms.accurate.select.server.percentage = 50
|
||||
@ -0,0 +1,22 @@
|
||||
# Http server port
|
||||
server.port=7700
|
||||
|
||||
spring.profiles.active=daily
|
||||
spring.main.banner-mode=log
|
||||
spring.jpa.open-in-view=false
|
||||
spring.data.mongodb.repositories.type=none
|
||||
logging.level.org.mongodb=warn
|
||||
|
||||
# Configuration for uploading files.
|
||||
spring.servlet.multipart.enabled=true
|
||||
spring.servlet.multipart.file-size-threshold=0
|
||||
spring.servlet.multipart.max-file-size=209715200
|
||||
spring.servlet.multipart.max-request-size=209715200
|
||||
|
||||
###### PowerJob transporter configuration ######
|
||||
oms.transporter.active.protocols=AKKA,HTTP
|
||||
oms.transporter.main.protocol=HTTP
|
||||
oms.akka.port=10086
|
||||
oms.http.port=10010
|
||||
# Prefix for all tables. Default empty string. Config if you have needs, i.e. pj_
|
||||
oms.table-prefix=pj_
|
||||
@ -0,0 +1,15 @@
|
||||
${AnsiColor.GREEN}
|
||||
███████ ██ ██
|
||||
░██░░░░██ ░██ ░██
|
||||
░██ ░██ ██████ ███ ██ █████ ██████ ░██ ██████ ░██
|
||||
░███████ ██░░░░██░░██ █ ░██ ██░░░██░░██░░█ ░██ ██░░░░██░██████
|
||||
░██░░░░ ░██ ░██ ░██ ███░██░███████ ░██ ░ ░██░██ ░██░██░░░██
|
||||
░██ ░██ ░██ ░████░████░██░░░░ ░██ ██ ░██░██ ░██░██ ░██
|
||||
░██ ░░██████ ███░ ░░░██░░██████░███ ░░█████ ░░██████ ░██████
|
||||
░░ ░░░░░░ ░░░ ░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░░ ░░░░░
|
||||
${AnsiColor.BRIGHT_RED}
|
||||
* Maintainer: tengjiqi@gmail.com & Team PowerJob
|
||||
* OfficialWebsite: http://www.powerjob.tech/
|
||||
* SourceCode: https://github.com/PowerJob/PowerJob
|
||||
* PoweredBy: SpringBoot${spring-boot.formatted-version}
|
||||
${AnsiColor.DEFAULT}
|
||||
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0"?>
|
||||
<included>
|
||||
|
||||
<property name="MONITOR_LOG_PATH" value="${LOG_PATH}/monitors"/>
|
||||
<property name="ROTATE_PATTERN" value="%d{yyyy-MM-dd}.%i"/>
|
||||
|
||||
<property name="MONITOR_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}|%thread|%X{serverId}|%msg%n"/>
|
||||
|
||||
<!-- database -->
|
||||
<appender name="MONITOR_LOGGER_DB_OPERATION_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${MONITOR_LOG_PATH}/database.log</file>
|
||||
<encoder>
|
||||
<pattern>${MONITOR_LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${MONITOR_LOG_PATH}/database.log.${ROTATE_PATTERN}</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<totalSizeCap>1000MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ASYNC_MONITOR_LOGGER_DB_OPERATION_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>512</queueSize>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="MONITOR_LOGGER_DB_OPERATION_APPENDER"/>
|
||||
</appender>
|
||||
<logger name="MONITOR_LOGGER_DB_OPERATION" level="INFO" additivity="false">
|
||||
<appender-ref ref="ASYNC_MONITOR_LOGGER_DB_OPERATION_APPENDER"/>
|
||||
</logger>
|
||||
|
||||
|
||||
<!-- TtReportInstanceStatusEvent -->
|
||||
<appender name="MONITOR_LOGGER_TT_REPORT_STATUS_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${MONITOR_LOG_PATH}/tt_status_report.log</file>
|
||||
<encoder>
|
||||
<pattern>${MONITOR_LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${MONITOR_LOG_PATH}/tt_status_report.log.${ROTATE_PATTERN}</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<totalSizeCap>1000MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ASYNC_MONITOR_LOGGER_TT_REPORT_STATUS_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>512</queueSize>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="MONITOR_LOGGER_TT_REPORT_STATUS_APPENDER"/>
|
||||
</appender>
|
||||
<logger name="MONITOR_LOGGER_TT_REPORT_STATUS" level="INFO" additivity="false">
|
||||
<appender-ref ref="ASYNC_MONITOR_LOGGER_TT_REPORT_STATUS_APPENDER"/>
|
||||
</logger>
|
||||
|
||||
<!-- WorkerHeartbeatEvent -->
|
||||
<appender name="MONITOR_LOGGER_WORKER_HEART_BEAT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${MONITOR_LOG_PATH}/worker_heartbeat.log</file>
|
||||
<encoder>
|
||||
<pattern>${MONITOR_LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${MONITOR_LOG_PATH}/worker_heartbeat.log.${ROTATE_PATTERN}</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<totalSizeCap>1000MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ASYNC_MONITOR_LOGGER_WORKER_HEART_BEAT_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>512</queueSize>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="MONITOR_LOGGER_WORKER_HEART_BEAT_APPENDER"/>
|
||||
</appender>
|
||||
<logger name="MONITOR_LOGGER_WORKER_HEART_BEAT" level="INFO" additivity="false">
|
||||
<appender-ref ref="ASYNC_MONITOR_LOGGER_WORKER_HEART_BEAT_APPENDER"/>
|
||||
</logger>
|
||||
|
||||
|
||||
<!-- WorkerLogReportEvent -->
|
||||
<appender name="MONITOR_LOGGER_WORKER_LOG_REPORT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${MONITOR_LOG_PATH}/worker_log_report.log</file>
|
||||
<encoder>
|
||||
<pattern>${MONITOR_LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${MONITOR_LOG_PATH}/worker_log_report.log.${ROTATE_PATTERN}</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<totalSizeCap>1000MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ASYNC_MONITOR_LOGGER_WORKER_LOG_REPORT_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>512</queueSize>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="MONITOR_LOGGER_WORKER_LOG_REPORT_APPENDER"/>
|
||||
</appender>
|
||||
<logger name="MONITOR_LOGGER_WORKER_LOG_REPORT" level="INFO" additivity="false">
|
||||
<appender-ref ref="ASYNC_MONITOR_LOGGER_WORKER_LOG_REPORT_APPENDER"/>
|
||||
</logger>
|
||||
|
||||
|
||||
<!-- SlowLockEvent -->
|
||||
<appender name="MONITOR_LOGGER_SLOW_LOCK_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${MONITOR_LOG_PATH}/lock.log</file>
|
||||
<encoder>
|
||||
<pattern>${MONITOR_LOG_PATTERN}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${MONITOR_LOG_PATH}/lock.log.${ROTATE_PATTERN}</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<totalSizeCap>1000MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<appender name="ASYNC_MONITOR_LOGGER_SLOW_LOCK_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<queueSize>512</queueSize>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<neverBlock>true</neverBlock>
|
||||
<appender-ref ref="MONITOR_LOGGER_SLOW_LOCK_APPENDER"/>
|
||||
</appender>
|
||||
<logger name="MONITOR_LOGGER_SLOW_LOCK" level="INFO" additivity="false">
|
||||
<appender-ref ref="ASYNC_MONITOR_LOGGER_SLOW_LOCK_APPENDER"/>
|
||||
</logger>
|
||||
|
||||
</included>
|
||||
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Configuration for local environment, all logs would print in console. -->
|
||||
<configuration>
|
||||
<!-- Configure color for logs. -->
|
||||
<!-- Classes for rendering color. -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Color log pattern. -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{20}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<logger name="MONITOR_LOGGER_DB_OPERATION" level="OFF"/>
|
||||
|
||||
<!-- Configuration for console output. -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Quit timing logs, which seems disordered. -->
|
||||
<logger name="tech.powerjob.server.service.timing" level="WARN" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="tech.powerjob" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Configuration for production environment. -->
|
||||
<configuration>
|
||||
|
||||
<!-- Default configuration. -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<!-- Configuration for console. -->
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
|
||||
<!--
|
||||
Log path, pay attention to permission, logs may be unable to generate.
|
||||
Bug recording: Setting `~/logs`, is unable to create folder in user home directory,
|
||||
a folder with the name ~ is created in project folder.
|
||||
-->
|
||||
<property name="LOG_PATH" value="${user.home}/powerjob/server/logs"/>
|
||||
|
||||
<!-- include other logback configs -->
|
||||
<include resource="logback-config/powerjob_monitor.xml"/>
|
||||
|
||||
<!-- Configuration for ERROR logs. All error logs will write twice. -->
|
||||
<appender name="ERROR_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/powerjob-server-error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<FileNamePattern>${LOG_PATH}/powerjob-server-error.%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<MaxHistory>7</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
<!-- End of configuration for ERROR logs. -->
|
||||
|
||||
<!-- Configuration for Web services. -->
|
||||
<appender name="WEB_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/powerjob-server-web.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<FileNamePattern>${LOG_PATH}/powerjob-server-web.%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<MaxHistory>7</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<append>true</append>
|
||||
</appender>
|
||||
<logger name="WEB_LOG" level="INFO" additivity="false">
|
||||
<appender-ref ref="WEB_LOG_APPENDER"/>
|
||||
</logger>
|
||||
<!-- End of configuration for Web services. -->
|
||||
|
||||
<!-- Configuration for system logs. -->
|
||||
<appender name="DEFAULT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/powerjob-server-application.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<FileNamePattern>${LOG_PATH}/powerjob-server-application.%d{yyyy-MM-dd}.log</FileNamePattern>
|
||||
<MaxHistory>7</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<append>true</append>
|
||||
</appender>
|
||||
<!-- End of configuration for system logs. -->
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="DEFAULT_APPENDER"/>
|
||||
<appender-ref ref="ERROR_APPENDER"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@ -24,14 +24,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
|
||||
<version>${powerjob.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.powerjob</groupId>
|
||||
<artifactId>powerjob-official-processors</artifactId>
|
||||
<version>${powerjob.version}</version>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
@ -141,30 +141,20 @@ services:
|
||||
privileged: true
|
||||
network_mode: "host"
|
||||
|
||||
|
||||
ruoyi-powerjob-mysql:
|
||||
environment:
|
||||
MYSQL_ROOT_HOST: "%"
|
||||
MYSQL_ROOT_PASSWORD: No1Bug2Please3!
|
||||
restart: always
|
||||
container_name: ruoyi-powerjob-mysql
|
||||
image: powerjob/powerjob-mysql:latest
|
||||
ports:
|
||||
- "3307:3306"
|
||||
volumes:
|
||||
- ./powerjob-data/powerjob-mysql:/var/lib/mysql
|
||||
command: --lower_case_table_names=1
|
||||
ruoyi-powerjob-server:
|
||||
image: powerjob/powerjob-server:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- ruoyi-powerjob-mysql
|
||||
- mysql
|
||||
environment:
|
||||
JVMOPTIONS: "-Xmx512m"
|
||||
PARAMS: "--oms.mongodb.enable=false --spring.datasource.core.jdbc-url=jdbc:mysql://ruoyi-powerjob-mysql:3306/powerjob-daily?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai"
|
||||
PARAMS: "--oms.mongodb.enable=false --spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai --spring.datasource.core.username=root --spring.datasource.core.password=root --oms.table-prefix=pj_"
|
||||
ports:
|
||||
- "7700:7700"
|
||||
- "10086:10086"
|
||||
- "10010:10010"
|
||||
volumes:
|
||||
- ./powerjob-data/powerjob-server:/root/powerjob/server/
|
||||
- /docker/powerjob-data/powerjob-server:/root/powerjob/server/
|
||||
privileged: true
|
||||
network_mode: "host"
|
||||
|
||||
|
||||
5
script/sql/powerjob_demo.sql
Normal file
5
script/sql/powerjob_demo.sql
Normal file
@ -0,0 +1,5 @@
|
||||
INSERT INTO `pj_app_info` (`id`, `app_name`, `current_server`, `gmt_create`, `gmt_modified`, `password`) VALUES (1, 'ruoyi-worker', '192.168.31.80:10010', '2023-06-13 16:32:59.263000', '2023-06-13 16:33:29.898000', 'ruoyi-worker');
|
||||
INSERT INTO `pj_job_info` (`id`, `alarm_config`, `app_id`, `concurrency`, `designated_workers`, `dispatch_strategy`, `execute_type`, `extra`, `gmt_create`, `gmt_modified`, `instance_retry_num`, `instance_time_limit`, `job_description`, `job_name`, `job_params`, `lifecycle`, `log_config`, `max_instance_num`, `max_worker_count`, `min_cpu_cores`, `min_disk_space`, `min_memory_space`, `next_trigger_time`, `notify_user_ids`, `processor_info`, `processor_type`, `status`, `tag`, `task_retry_num`, `time_expression`, `time_expression_type`) VALUES (1, '{\"alertThreshold\":0,\"silenceWindowLen\":0,\"statisticWindowLen\":0}', 1, 5, '', 2, 1, NULL, '2023-06-02 15:01:27.717000', '2023-06-02 16:03:19.462000', 1, 0, '', '单机处理器执行测试', NULL, '{}', '{\"type\":1}', 0, 0, 0, 0, 0, NULL, NULL, 'org.dromara.job.processors.StandaloneProcessorDemo', 1, 1, NULL, 1, '30000', 3);
|
||||
INSERT INTO `pj_job_info` (`id`, `alarm_config`, `app_id`, `concurrency`, `designated_workers`, `dispatch_strategy`, `execute_type`, `extra`, `gmt_create`, `gmt_modified`, `instance_retry_num`, `instance_time_limit`, `job_description`, `job_name`, `job_params`, `lifecycle`, `log_config`, `max_instance_num`, `max_worker_count`, `min_cpu_cores`, `min_disk_space`, `min_memory_space`, `next_trigger_time`, `notify_user_ids`, `processor_info`, `processor_type`, `status`, `tag`, `task_retry_num`, `time_expression`, `time_expression_type`) VALUES (2, '{\"alertThreshold\":0,\"silenceWindowLen\":0,\"statisticWindowLen\":0}', 1, 5, '', 1, 2, NULL, '2023-06-02 15:04:45.342000', '2023-06-02 16:04:09.736000', 0, 0, NULL, '广播处理器测试', NULL, '{}', '{\"type\":1}', 0, 0, 0, 0, 0, NULL, NULL, 'org.dromara.job.processors.BroadcastProcessorDemo', 1, 1, NULL, 1, '30000', 3);
|
||||
INSERT INTO `pj_job_info` (`id`, `alarm_config`, `app_id`, `concurrency`, `designated_workers`, `dispatch_strategy`, `execute_type`, `extra`, `gmt_create`, `gmt_modified`, `instance_retry_num`, `instance_time_limit`, `job_description`, `job_name`, `job_params`, `lifecycle`, `log_config`, `max_instance_num`, `max_worker_count`, `min_cpu_cores`, `min_disk_space`, `min_memory_space`, `next_trigger_time`, `notify_user_ids`, `processor_info`, `processor_type`, `status`, `tag`, `task_retry_num`, `time_expression`, `time_expression_type`) VALUES (3, '{\"alertThreshold\":0,\"silenceWindowLen\":0,\"statisticWindowLen\":0}', 1, 5, '', 1, 4, NULL, '2023-06-02 15:13:23.519000', '2023-06-02 16:03:22.421000', 0, 0, NULL, 'Map处理器测试', NULL, '{}', '{\"type\":1}', 0, 0, 0, 0, 0, NULL, NULL, 'org.dromara.job.processors.MapProcessorDemo', 1, 2, NULL, 1, '1000', 3);
|
||||
INSERT INTO `pj_job_info` (`id`, `alarm_config`, `app_id`, `concurrency`, `designated_workers`, `dispatch_strategy`, `execute_type`, `extra`, `gmt_create`, `gmt_modified`, `instance_retry_num`, `instance_time_limit`, `job_description`, `job_name`, `job_params`, `lifecycle`, `log_config`, `max_instance_num`, `max_worker_count`, `min_cpu_cores`, `min_disk_space`, `min_memory_space`, `next_trigger_time`, `notify_user_ids`, `processor_info`, `processor_type`, `status`, `tag`, `task_retry_num`, `time_expression`, `time_expression_type`) VALUES (4, '{\"alertThreshold\":0,\"silenceWindowLen\":0,\"statisticWindowLen\":0}', 1, 5, '', 1, 3, NULL, '2023-06-02 15:45:25.896000', '2023-06-02 16:03:23.125000', 0, 0, NULL, 'MapReduce处理器测试', NULL, '{}', '{\"type\":1}', 0, 0, 0, 0, 0, NULL, NULL, 'org.dromara.job.processors.MapReduceProcessorDemo', 1, 2, NULL, 1, '1000', 3);
|
||||
Loading…
Reference in New Issue
Block a user