parent
b4c9687f4c
commit
4157bac93f
|
|
@ -9,17 +9,16 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
|
import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
|
||||||
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
|
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
|
||||||
import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration;
|
import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration;
|
||||||
|
import org.apache.shardingsphere.api.config.sharding.strategy.InlineShardingStrategyConfiguration;
|
||||||
import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;
|
import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -31,6 +30,9 @@ import java.util.stream.Collectors;
|
||||||
@ConfigurationProperties(prefix = "spring.shardingsphere")
|
@ConfigurationProperties(prefix = "spring.shardingsphere")
|
||||||
public class ShardingConfig {
|
public class ShardingConfig {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String activeProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取数据源信息
|
* 读取数据源信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,12 +51,46 @@ public class ShardingConfig {
|
||||||
*/
|
*/
|
||||||
private String centerTablesDataNode;
|
private String centerTablesDataNode;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 中心表,不进行分库操作
|
* 中心表,不进行分库操作
|
||||||
*/
|
*/
|
||||||
private List<String> centerTables;
|
private Set<String> centerTables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域库的节点
|
||||||
|
*/
|
||||||
|
private String regionTablesDataNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域表分库策略的字段
|
||||||
|
*/
|
||||||
|
private String regionTablesShardingDatabaseColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域表分库的算法
|
||||||
|
*/
|
||||||
|
private String regionTablesShardingDatabaseAlgorithm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分库表,通过userId进行分库
|
||||||
|
*/
|
||||||
|
private Set<String> regionTables;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域表分库策略的字段
|
||||||
|
*/
|
||||||
|
private String courseDetailsShardingDatabaseColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域表分库的算法
|
||||||
|
*/
|
||||||
|
private String courseDetailsShardingDatabaseAlgorithm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分库表,通过userId进行分库
|
||||||
|
*/
|
||||||
|
private Set<String> courseDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置sharding-jdbc数据源
|
* 配置sharding-jdbc数据源
|
||||||
|
|
@ -88,15 +124,36 @@ public class ShardingConfig {
|
||||||
String.format(centerTablesDataNode, centerTable));
|
String.format(centerTablesDataNode, centerTable));
|
||||||
sets.add(tableRuleConfig);
|
sets.add(tableRuleConfig);
|
||||||
}
|
}
|
||||||
|
if ("prod".equals(activeProfile)) {
|
||||||
|
// 定义区域表的分库规则
|
||||||
|
InlineShardingStrategyConfiguration databaseShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||||
|
regionTablesShardingDatabaseColumn, regionTablesShardingDatabaseAlgorithm);
|
||||||
|
for (String regionTable : regionTables) {
|
||||||
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||||
|
tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
||||||
|
sets.add(tableRuleConfig);
|
||||||
|
}
|
||||||
|
|
||||||
// // 定义区域表的分库规则
|
// 定义区域表的分库规则
|
||||||
// InlineShardingStrategyConfiguration databaseShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
InlineShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||||
// regionTablesShardingDatabaseColumn, regionTablesShardingDatabaseAlgorithm);
|
courseDetailsShardingDatabaseColumn, courseDetailsShardingDatabaseAlgorithm);
|
||||||
// for (String regionTable : regionTables) {
|
for (String regionTable : courseDetails) {
|
||||||
// TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||||
// tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
tableRuleConfig.setDatabaseShardingStrategyConfig(courseDetailsShardingStrategyConfig);
|
||||||
// sets.add(tableRuleConfig);
|
sets.add(tableRuleConfig);
|
||||||
// }
|
}
|
||||||
|
}else {
|
||||||
|
for (String centerTable : regionTables) {
|
||||||
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(centerTable,
|
||||||
|
String.format(centerTablesDataNode, centerTable));
|
||||||
|
sets.add(tableRuleConfig);
|
||||||
|
}
|
||||||
|
for (String centerTable : courseDetails) {
|
||||||
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(centerTable,
|
||||||
|
String.format(centerTablesDataNode, centerTable));
|
||||||
|
sets.add(tableRuleConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
return sets;
|
return sets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,10 @@ connection-timeout: 30000
|
||||||
spring:
|
spring:
|
||||||
# sharding-jdbc 配置
|
# sharding-jdbc 配置
|
||||||
shardingsphere:
|
shardingsphere:
|
||||||
center-tables-data-node: duanju.%s
|
|
||||||
# 显示sharding-jdbc改写的sql语句
|
# 显示sharding-jdbc改写的sql语句
|
||||||
show-sql: false
|
show-sql: false
|
||||||
|
|
||||||
|
center-tables-data-node: duanju.%s
|
||||||
# 数据源名称
|
# 数据源名称
|
||||||
datasource:
|
datasource:
|
||||||
# 数据源配置begin
|
# 数据源配置begin
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
swagger:
|
swagger:
|
||||||
enabled: true
|
enabled: false
|
||||||
pay:
|
pay:
|
||||||
h5BaseUrl: https://video-h5.hnsiyao.cn/me/detail/detail?allId=
|
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
|
||||||
orderNotifyUrl: https://video.hnsiyao.cn/czg/app/wuyou/notify
|
orderNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/notify
|
||||||
extractNotifyUrl: https://video.hnsiyao.cn/czg/app/wuyou/extractNotify
|
extractNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/extractNotify
|
||||||
|
|
||||||
# 数据源的一些配置
|
# 数据源的一些配置
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
@ -22,14 +22,24 @@ spring:
|
||||||
# sharding-jdbc 配置
|
# sharding-jdbc 配置
|
||||||
shardingsphere:
|
shardingsphere:
|
||||||
center-tables-data-node: duanju.%s
|
center-tables-data-node: duanju.%s
|
||||||
|
# 区域表的数据源节点
|
||||||
|
region-tables-data-node: duanju-$->{0..4}.%s
|
||||||
|
# 区域分库策略的计算字段
|
||||||
|
region-tables-sharding-database-column: user_id
|
||||||
|
# 分库的计算方法
|
||||||
|
region-tables-sharding-database-algorithm: duanju-$->{Math.abs(user_id) % 5}
|
||||||
|
|
||||||
|
# 短剧集表 拆分
|
||||||
|
course_details-sharding-database-column: course_id
|
||||||
|
course_details-sharding-database-algorithm: duanju-$->{Math.abs(course_id) % 5}
|
||||||
|
|
||||||
# 显示sharding-jdbc改写的sql语句
|
# 显示sharding-jdbc改写的sql语句
|
||||||
show-sql: false
|
show-sql: false
|
||||||
# 数据源名称
|
# 数据源名称
|
||||||
datasource:
|
datasource:
|
||||||
# 数据源配置begin
|
master:
|
||||||
master-0:
|
|
||||||
driver-class-name: ${driver-class-name}
|
driver-class-name: ${driver-class-name}
|
||||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||||
username: video_user
|
username: video_user
|
||||||
password: VideoUser@1
|
password: VideoUser@1
|
||||||
minimum-idle: ${minimum-idle}
|
minimum-idle: ${minimum-idle}
|
||||||
|
|
@ -37,11 +47,112 @@ spring:
|
||||||
idle-timeout: ${idle-timeout}
|
idle-timeout: ${idle-timeout}
|
||||||
max-lifetime: ${max-lifetime}
|
max-lifetime: ${max-lifetime}
|
||||||
connection-timeout: ${connection-timeout}
|
connection-timeout: ${connection-timeout}
|
||||||
|
# 数据源配置begin
|
||||||
|
master-0:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-1:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-2:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-3:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-4:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
slave-0:
|
slave-0:
|
||||||
driver-class-name: ${driver-class-name}
|
driver-class-name: ${driver-class-name}
|
||||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
jdbc-url:
|
||||||
username: root
|
username:
|
||||||
password: 0fd6497c308ccfa8
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-1:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-2:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-3:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-4:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
minimum-idle: ${minimum-idle}
|
minimum-idle: ${minimum-idle}
|
||||||
maximum-pool-size: ${maximum-pool-size}
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
idle-timeout: ${idle-timeout}
|
idle-timeout: ${idle-timeout}
|
||||||
|
|
@ -53,6 +164,21 @@ spring:
|
||||||
master-slave-rules:
|
master-slave-rules:
|
||||||
#数据源
|
#数据源
|
||||||
duanju:
|
duanju:
|
||||||
|
master-data-source-name: master
|
||||||
|
slave-data-source-names: slave
|
||||||
|
duanju-0:
|
||||||
master-data-source-name: master-0
|
master-data-source-name: master-0
|
||||||
slave-data-source-names:
|
slave-data-source-names: slave-0
|
||||||
- slave-0
|
duanju-1:
|
||||||
|
master-data-source-name: master-1
|
||||||
|
slave-data-source-names: slave-1
|
||||||
|
duanju-2:
|
||||||
|
master-data-source-name: master-2
|
||||||
|
slave-data-source-names: slave-2
|
||||||
|
duanju-3:
|
||||||
|
master-data-source-name: master-3
|
||||||
|
slave-data-source-names: slave-3
|
||||||
|
duanju-4:
|
||||||
|
master-data-source-name: master-4
|
||||||
|
slave-data-source-names: slave-4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,24 @@ connection-timeout: 30000
|
||||||
spring:
|
spring:
|
||||||
# sharding-jdbc 配置
|
# sharding-jdbc 配置
|
||||||
shardingsphere:
|
shardingsphere:
|
||||||
center-tables-data-node: duanju.%s
|
|
||||||
# 显示sharding-jdbc改写的sql语句
|
# 显示sharding-jdbc改写的sql语句
|
||||||
show-sql: false
|
show-sql: false
|
||||||
|
|
||||||
|
center-tables-data-node: duanju.%s
|
||||||
|
# 区域表的数据源节点
|
||||||
|
region-tables-data-node: duanju-$->{0..4}.%s
|
||||||
|
# 区域分库策略的计算字段
|
||||||
|
region-tables-sharding-database-column: user_id
|
||||||
|
# 分库的计算方法
|
||||||
|
region-tables-sharding-database-algorithm: duanju-$->{Math.abs(user_id) % 5}
|
||||||
|
|
||||||
|
# 短剧集表 拆分
|
||||||
|
course_details-sharding-database-column: course_id
|
||||||
|
course_details-sharding-database-algorithm: duanju-$->{Math.abs(course_id) % 5}
|
||||||
|
|
||||||
# 数据源名称
|
# 数据源名称
|
||||||
datasource:
|
datasource:
|
||||||
# 数据源配置begin
|
master:
|
||||||
master-0:
|
|
||||||
driver-class-name: ${driver-class-name}
|
driver-class-name: ${driver-class-name}
|
||||||
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||||
username: video_user
|
username: video_user
|
||||||
|
|
@ -37,31 +48,112 @@ spring:
|
||||||
idle-timeout: ${idle-timeout}
|
idle-timeout: ${idle-timeout}
|
||||||
max-lifetime: ${max-lifetime}
|
max-lifetime: ${max-lifetime}
|
||||||
connection-timeout: ${connection-timeout}
|
connection-timeout: ${connection-timeout}
|
||||||
# slave-0:
|
# 数据源配置begin
|
||||||
# driver-class-name: ${driver-class-name}
|
master-0:
|
||||||
# jdbc-url: jdbc:mysql://localhost:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
driver-class-name: ${driver-class-name}
|
||||||
# username: root
|
jdbc-url:
|
||||||
# password: acddb0c84a192ada
|
username:
|
||||||
# minimum-idle: ${minimum-idle}
|
password:
|
||||||
# maximum-pool-size: ${maximum-pool-size}
|
minimum-idle: ${minimum-idle}
|
||||||
# idle-timeout: ${idle-timeout}
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
# max-lifetime: ${max-lifetime}
|
idle-timeout: ${idle-timeout}
|
||||||
# connection-timeout: ${connection-timeout}
|
max-lifetime: ${max-lifetime}
|
||||||
# slave-1:
|
connection-timeout: ${connection-timeout}
|
||||||
# driver-class-name: ${driver-class-name}
|
master-1:
|
||||||
# jdbc-url: jdbc:mysql://172.18.96.9:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
driver-class-name: ${driver-class-name}
|
||||||
# username: root
|
jdbc-url:
|
||||||
# password: VideoUser1@
|
username:
|
||||||
# minimum-idle: ${minimum-idle}
|
password:
|
||||||
# maximum-pool-size: ${maximum-pool-size}
|
minimum-idle: ${minimum-idle}
|
||||||
# idle-timeout: ${idle-timeout}
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
# max-lifetime: ${max-lifetime}
|
idle-timeout: ${idle-timeout}
|
||||||
# connection-timeout: ${connection-timeout}
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-2:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-3:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
master-4:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-0:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-1:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
slave-2:
|
slave-2:
|
||||||
driver-class-name: ${driver-class-name}
|
driver-class-name: ${driver-class-name}
|
||||||
jdbc-url: jdbc:mysql://172.18.96.8:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
jdbc-url:
|
||||||
username: root
|
username:
|
||||||
password: VideoUser1@
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-3:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
|
slave-4:
|
||||||
|
driver-class-name: ${driver-class-name}
|
||||||
|
jdbc-url:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
minimum-idle: ${minimum-idle}
|
minimum-idle: ${minimum-idle}
|
||||||
maximum-pool-size: ${maximum-pool-size}
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
idle-timeout: ${idle-timeout}
|
idle-timeout: ${idle-timeout}
|
||||||
|
|
@ -73,9 +165,21 @@ spring:
|
||||||
master-slave-rules:
|
master-slave-rules:
|
||||||
#数据源
|
#数据源
|
||||||
duanju:
|
duanju:
|
||||||
|
master-data-source-name: master
|
||||||
|
slave-data-source-names: slave
|
||||||
|
duanju-0:
|
||||||
master-data-source-name: master-0
|
master-data-source-name: master-0
|
||||||
# slave-data-source-names: slave-0,slave-1,slave-2
|
slave-data-source-names: slave-0
|
||||||
|
duanju-1:
|
||||||
|
master-data-source-name: master-1
|
||||||
|
slave-data-source-names: slave-1
|
||||||
|
duanju-2:
|
||||||
|
master-data-source-name: master-2
|
||||||
slave-data-source-names: slave-2
|
slave-data-source-names: slave-2
|
||||||
# - slave-0
|
duanju-3:
|
||||||
# - slave-1
|
master-data-source-name: master-3
|
||||||
# - slave-2
|
slave-data-source-names: slave-3
|
||||||
|
duanju-4:
|
||||||
|
master-data-source-name: master-4
|
||||||
|
slave-data-source-names: slave-4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ spring:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
# 环境 dev|test|prod
|
# 环境 dev|test|prod
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
# jackson时间格式化
|
# jackson时间格式化
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
|
|
@ -93,74 +93,79 @@ spring:
|
||||||
# pathmatch:
|
# pathmatch:
|
||||||
# matching-strategy: ant_path_matcher
|
# matching-strategy: ant_path_matcher
|
||||||
shardingsphere:
|
shardingsphere:
|
||||||
center-tables:
|
# 短剧集表 通过course_id 分
|
||||||
- activity
|
course-details:
|
||||||
- app
|
|
||||||
- banner
|
|
||||||
- cash_out
|
|
||||||
- comment_good
|
|
||||||
- common_info
|
|
||||||
- complet_award
|
|
||||||
- coupon
|
|
||||||
- coupon_user
|
|
||||||
- course
|
|
||||||
- course_classification
|
|
||||||
- course_collect
|
|
||||||
- course_comment
|
|
||||||
- course_details
|
- course_details
|
||||||
- course_user
|
#分库表 通过user_Id分
|
||||||
- disc_spinning
|
region-tables:
|
||||||
- disc_spinning_amount
|
- user_money_details
|
||||||
- disc_spinning_record
|
|
||||||
- help_classify
|
|
||||||
- help_word
|
|
||||||
- invite
|
|
||||||
- invite_award
|
|
||||||
- invite_money
|
|
||||||
- message_info
|
|
||||||
- msg
|
|
||||||
- orders
|
- orders
|
||||||
- pay_classify
|
- course_collect
|
||||||
- pay_details
|
- pay_details
|
||||||
- qrtz_blob_triggers
|
- disc_spinning_record
|
||||||
- qrtz_calendars
|
- cash_out
|
||||||
- qrtz_cron_triggers
|
- course_user
|
||||||
- qrtz_fired_triggers
|
- tb_user
|
||||||
- qrtz_job_details
|
- task_center_record
|
||||||
- qrtz_locks
|
- user_money
|
||||||
- qrtz_paused_trigger_grps
|
- user_sign_record
|
||||||
- qrtz_scheduler_state
|
- invite_achievement
|
||||||
- qrtz_simple_triggers
|
- invite_money
|
||||||
- qrtz_simprop_triggers
|
#中心表
|
||||||
- qrtz_triggers
|
center-tables:
|
||||||
- schedule_job
|
- message_info
|
||||||
- schedule_job_log
|
- schedule_job_log
|
||||||
|
- invite
|
||||||
|
- msg
|
||||||
|
- sys_role_menu
|
||||||
- sdk_info
|
- sdk_info
|
||||||
|
- course
|
||||||
|
- user_integral_details
|
||||||
|
- common_info
|
||||||
|
- sys_log
|
||||||
|
- user_vip
|
||||||
|
- uni_ad_callback_record
|
||||||
|
- sys_user_role
|
||||||
|
- sys_menu
|
||||||
|
- comment_good
|
||||||
|
- sys_user
|
||||||
|
- course_comment
|
||||||
|
- banner
|
||||||
|
- disc_spinning
|
||||||
|
- course_classification
|
||||||
|
- task_center
|
||||||
- sdk_type
|
- sdk_type
|
||||||
- search
|
- task_center_reward
|
||||||
- sys_captcha
|
- schedule_job
|
||||||
|
- help_word
|
||||||
|
- help_classify
|
||||||
|
- disc_spinning_amount
|
||||||
|
- activity
|
||||||
|
- vip_details
|
||||||
|
- sys_role
|
||||||
|
- pay_classify
|
||||||
|
- app
|
||||||
|
- invite_award
|
||||||
|
- complet_award
|
||||||
|
- url_address
|
||||||
- sys_config
|
- sys_config
|
||||||
- sys_dict
|
- sys_dict
|
||||||
- sys_log
|
|
||||||
- sys_menu
|
|
||||||
- sys_oss
|
- sys_oss
|
||||||
- sys_role
|
- search
|
||||||
- sys_role_menu
|
- coupon_user
|
||||||
- sys_user
|
- coupon
|
||||||
- sys_user_role
|
|
||||||
- sys_user_token
|
|
||||||
- task_center
|
|
||||||
- task_center_record
|
|
||||||
- task_center_reward
|
|
||||||
- tb_user
|
|
||||||
- uni_ad_callback_record
|
|
||||||
- url_address
|
|
||||||
- user_integral
|
|
||||||
- user_integral_details
|
|
||||||
- user_money
|
|
||||||
- user_money_details
|
|
||||||
- user_prize_exchange
|
- user_prize_exchange
|
||||||
- user_sign_record
|
- user_integral
|
||||||
- user_vip
|
- sys_user_token
|
||||||
- vip_details
|
- sys_captcha
|
||||||
- invite_achievement
|
- qrtz_triggers
|
||||||
|
- qrtz_simprop_triggers
|
||||||
|
- qrtz_simple_triggers
|
||||||
|
- qrtz_scheduler_state
|
||||||
|
- qrtz_paused_trigger_grps
|
||||||
|
- qrtz_locks
|
||||||
|
- qrtz_job_details
|
||||||
|
- qrtz_fired_triggers
|
||||||
|
- qrtz_cron_triggers
|
||||||
|
- qrtz_calendars
|
||||||
|
- qrtz_blob_triggers
|
||||||
Loading…
Reference in New Issue