parent
1dbf8bc174
commit
5bf48b3cd4
@ -16,13 +16,13 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: easy_retry
|
||||
MYSQL_DATABASE: snail_job
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql/
|
||||
# 注入初始化脚本
|
||||
- ../sql/easy_retry_mysql.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
- ../sql/snail_job_mysql.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
command:
|
||||
--default-authentication-plugin=mysql_native_password
|
||||
--character-set-server=utf8mb4
|
||||
@ -35,13 +35,13 @@ services:
|
||||
environment:
|
||||
POSTGRES_USER: root
|
||||
POSTGRES_PASSWORD: root
|
||||
POSTGRES_DB: easy_retry
|
||||
POSTGRES_DB: snail_job
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
# 注入初始化脚本
|
||||
- ../sql/easy_retry_postgre.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
- ../sql/snail_job_postgre.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
|
||||
oracle:
|
||||
image: gvenzl/oracle-xe:18-slim-faststart
|
||||
@ -52,8 +52,8 @@ services:
|
||||
- "1521:1521"
|
||||
volumes:
|
||||
- oracle:/u01/app/oracle/oradata
|
||||
- ../sql/easy_retry_oracle.sql:/tmp/schema.sql:ro
|
||||
# 创建app用户: easy_retry/EasyRetry@//localhost/XEPDB1
|
||||
- ../sql/snail_job_oracle.sql:/tmp/schema.sql:ro
|
||||
# 创建app用户: snail_job/SnailJob@//localhost/XEPDB1
|
||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
||||
|
||||
@ -62,12 +62,12 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ACCEPT_EULA: "Y"
|
||||
SA_PASSWORD: "EasyRetry@24"
|
||||
SA_PASSWORD: "SnailJob@24"
|
||||
ports:
|
||||
- "1433:1433"
|
||||
volumes:
|
||||
- sqlserver:/var/opt/mssql
|
||||
- ../sql/easy_retry_sqlserver.sql:/tmp/schema.sql:ro
|
||||
- ../sql/snail_job_sqlserver.sql:/tmp/schema.sql:ro
|
||||
# docker compose exec sqlserver bash /tmp/create_schema.sh
|
||||
- ./sqlserver/create_schema.sh:/tmp/create_schema.sh:ro
|
||||
|
||||
@ -77,10 +77,10 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MARIADB_ROOT_PASSWORD: root
|
||||
MARIADB_DATABASE: easy_retry
|
||||
MARIADB_DATABASE: snail_job
|
||||
ports:
|
||||
- "3308:3306"
|
||||
volumes:
|
||||
- mariadb:/var/lib/mysql/
|
||||
# 注入初始化脚本, mysql
|
||||
- ../sql/easy_retry_mysql.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
- ../sql/snail_job_mysql.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
|
@ -1,5 +1,5 @@
|
||||
ALTER SESSION SET CONTAINER=XEPDB1;
|
||||
|
||||
CREATE USER EASY_RETRY IDENTIFIED BY EasyRetry QUOTA UNLIMITED ON USERS;
|
||||
CREATE USER SNAIL_JOB IDENTIFIED BY SnailJob QUOTA UNLIMITED ON USERS;
|
||||
|
||||
GRANT CONNECT, RESOURCE TO EASY_RETRY;
|
||||
GRANT CONNECT, RESOURCE TO SNAIL_JOB;
|
||||
|
@ -1 +1 @@
|
||||
sqlplus -s easy_retry/EasyRetry@//localhost/XEPDB1 @/tmp/schema.sql
|
||||
sqlplus -s snail_job/SnailJob@//localhost/XEPDB1 @/tmp/schema.sql
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'EasyRetry@24' -Q "CREATE DATABASE easy_retry;
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'SnailJob@24' -Q "CREATE DATABASE snail_job;
|
||||
GO"
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'EasyRetry@24' -d easy_retry -i /tmp/schema.sql
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'SnailJob@24' -d snail_job -i /tmp/schema.sql
|
||||
|
@ -1,8 +1,8 @@
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DROP DATABASE IF EXISTS easy_retry;
|
||||
CREATE DATABASE easy_retry;
|
||||
USE easy_retry;
|
||||
DROP DATABASE IF EXISTS snail_job;
|
||||
CREATE DATABASE snail_job;
|
||||
USE snail_job;
|
||||
|
||||
CREATE TABLE `namespace`
|
||||
(
|
||||
|
@ -32,9 +32,9 @@ import java.util.Optional;
|
||||
* @date : 2023-08-04 12:37
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan("com.aizuda.easy.retry.template.datasource.**")
|
||||
@MapperScan(value = "com.aizuda.easy.retry.template.datasource.persistence.mapper", sqlSessionTemplateRef = "sqlSessionTemplate")
|
||||
public class EasyRetryTemplateAutoConfiguration {
|
||||
@ComponentScan("com.aizuda.snail.job.template.datasource.**")
|
||||
@MapperScan(value = "com.aizuda.snail.job.template.datasource.persistence.mapper", sqlSessionTemplateRef = "sqlSessionTemplate")
|
||||
public class SnailJobTemplateAutoConfiguration {
|
||||
@Bean("sqlSessionFactory")
|
||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource, Environment environment, MybatisPlusInterceptor mybatisPlusInterceptor, MybatisPlusProperties mybatisPlusProperties) throws Exception {
|
||||
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
|
||||
@ -59,7 +59,7 @@ public class EasyRetryTemplateAutoConfiguration {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
|
||||
private static final List<String> TABLES = Arrays.asList("retry_task", "retry_dead_letter");
|
||||
private static final List<String> TABLES_WITH_PARTITION = Arrays.asList("retry_task", "retry_dead_letter");
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(Environment environment) {
|
||||
@ -75,7 +75,7 @@ public class EasyRetryTemplateAutoConfiguration {
|
||||
public DynamicTableNameInnerInterceptor dynamicTableNameInnerInterceptor(String tablePrefix) {
|
||||
DynamicTableNameInnerInterceptor dynamicTableNameInnerInterceptor = new DynamicTableNameInnerInterceptor();
|
||||
dynamicTableNameInnerInterceptor.setTableNameHandler((sql, tableName) -> {
|
||||
if (TABLES.contains(tableName)) {
|
||||
if (TABLES_WITH_PARTITION.contains(tableName)) {
|
||||
Integer partition = RequestDataHelper.getPartition();
|
||||
RequestDataHelper.remove();
|
||||
tableName = tableName + StrUtil.UNDERLINE + partition;
|
@ -1 +1 @@
|
||||
com.aizuda.snail.job.template.datasource.config.EasyRetryTemplateAutoConfiguration
|
||||
com.aizuda.snail.job.template.datasource.config.SnailJobTemplateAutoConfiguration
|
||||
|
@ -7,30 +7,30 @@ spring:
|
||||
profiles:
|
||||
active: dev
|
||||
datasource:
|
||||
name: easy_retry
|
||||
name: snail_job
|
||||
## mysql
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/easy_retry?useSSL=false&characterEncoding=utf8&useUnicode=true
|
||||
url: jdbc:mysql://localhost:3306/snail_job?useSSL=false&characterEncoding=utf8&useUnicode=true
|
||||
username: root
|
||||
password: root
|
||||
## postgres
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/easy_retry?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# url: jdbc:postgresql://localhost:5432/snail_job?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
## Oracle
|
||||
# driver-class-name: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XEPDB1
|
||||
# username: easy_retry
|
||||
# password: EasyRetry
|
||||
# username: snail_job
|
||||
# password: SnailJob
|
||||
## SQL Server 注意:由于system_user为SQLServer系统函数,因此SQLServer需要启用前缀配置,请配置mybatis-plus.global-config.db-config.table-prefix: er_
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=easy_retry;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=snail_job;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: EasyRetry@24
|
||||
# password: SnailJob@24
|
||||
## mariadb
|
||||
# driver-class-name: org.mariadb.jdbc.Driver
|
||||
# url: jdbc:mariadb://localhost:3308/easy_retry?useSSL=false&characterEncoding=utf8&useUnicode=true
|
||||
# url: jdbc:mariadb://localhost:3308/snail_job?useSSL=false&characterEncoding=utf8&useUnicode=true
|
||||
# username: root
|
||||
# password: root
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
@ -40,14 +40,14 @@ spring:
|
||||
maximum-pool-size: 20
|
||||
auto-commit: true
|
||||
idle-timeout: 30000
|
||||
pool-name: easy_retry
|
||||
pool-name: snail_job
|
||||
max-lifetime: 1800000
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:admin/
|
||||
|
||||
mybatis-plus:
|
||||
typeAliasesPackage: com.aizuda.easy.retry.template.datasource.persistence.po
|
||||
typeAliasesPackage: com.aizuda.snail.job.template.datasource.persistence.po
|
||||
global-config:
|
||||
db-config:
|
||||
where-strategy: NOT_EMPTY
|
||||
@ -63,7 +63,7 @@ logging:
|
||||
config: classpath:logback-boot.xml
|
||||
# level:
|
||||
# ## 方便调试 SQL
|
||||
# com.aizuda.easy.retry.template.datasource.persistence.mapper: debug
|
||||
# com.aizuda.snail.job.template.datasource.persistence.mapper: debug
|
||||
|
||||
snail-job:
|
||||
retry-pull-page-size: 1000 # 拉取重试数据的每批次的大小
|
||||
|
Loading…
Reference in New Issue
Block a user