rev:集群日志修改
This commit is contained in:
@@ -109,6 +109,17 @@
|
|||||||
<!-- <artifactId>logback-elasticsearch-appender</artifactId>-->
|
<!-- <artifactId>logback-elasticsearch-appender</artifactId>-->
|
||||||
<!-- <version>1.6</version>-->
|
<!-- <version>1.6</version>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.shardingsphere/sharding-jdbc-spring-boot-starter -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.shardingsphere</groupId>-->
|
||||||
|
<!-- <artifactId>sharding-jdbc-spring-boot-starter</artifactId>-->
|
||||||
|
<!-- <version>4.1.1</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shardingsphere</groupId>
|
||||||
|
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
|
||||||
|
<version>5.0.0-alpha</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 图片缩略图 -->
|
<!-- 图片缩略图 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ import org.mybatis.spring.annotation.MapperScan;
|
|||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package org.nl.config;
|
|||||||
|
|
||||||
import com.alibaba.druid.filter.FilterChain;
|
import com.alibaba.druid.filter.FilterChain;
|
||||||
import com.alibaba.druid.filter.FilterEventAdapter;
|
import com.alibaba.druid.filter.FilterEventAdapter;
|
||||||
import com.alibaba.druid.proxy.jdbc.JdbcParameter;
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy;
|
import com.alibaba.druid.proxy.jdbc.*;
|
||||||
import com.alibaba.druid.proxy.jdbc.ResultSetProxy;
|
|
||||||
import com.alibaba.druid.proxy.jdbc.StatementProxy;
|
|
||||||
import com.alibaba.druid.sql.SQLUtils;
|
import com.alibaba.druid.sql.SQLUtils;
|
||||||
import com.alibaba.druid.util.JdbcUtils;
|
import com.alibaba.druid.util.JdbcUtils;
|
||||||
import com.mysql.cj.jdbc.result.ResultSetImpl;
|
import com.mysql.cj.jdbc.result.ResultSetImpl;
|
||||||
@@ -13,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -60,6 +59,8 @@ public class DruidFilter extends FilterEventAdapter {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ResultSetProxy statement_getResultSet(FilterChain chain, StatementProxy statement) throws SQLException {
|
public ResultSetProxy statement_getResultSet(FilterChain chain, StatementProxy statement) throws SQLException {
|
||||||
|
String jdbc = chain.getDataSource().getRawJdbcUrl();
|
||||||
|
System.out.println(jdbc);
|
||||||
ResultSetProxy rs = super.statement_getResultSet(chain, statement);
|
ResultSetProxy rs = super.statement_getResultSet(chain, statement);
|
||||||
String executeSql = statement.getLastExecuteSql();
|
String executeSql = statement.getLastExecuteSql();
|
||||||
if (true){
|
if (true){
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ import javax.sql.DataSource;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MybatisPlusConfig {
|
public class MybatisPlusConfig {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DataSource dataSource;
|
|
||||||
/**
|
/**
|
||||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
||||||
添加自增插件
|
添加自增插件
|
||||||
@@ -36,11 +33,4 @@ public class MybatisPlusConfig {
|
|||||||
|
|
||||||
return interceptor;
|
return interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void datainnit(){
|
|
||||||
String url = ((DruidDataSource) dataSource).getUrl();
|
|
||||||
System.out.println("项目数据库地址:"+url);
|
|
||||||
log.debug("项目数据库地址:{}",url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class WQLCore {
|
|||||||
//解析wql文件的根目录
|
//解析wql文件的根目录
|
||||||
public static String ROOT = "wql";
|
public static String ROOT = "wql";
|
||||||
//数据库默认名
|
//数据库默认名
|
||||||
public static String defalutDBName = "dataSource";
|
public static String defalutDBName = "dataSource";//集群时使用SpringContextHolder.getBean("shardingSphereDataSource")
|
||||||
//wql源文件
|
//wql源文件
|
||||||
public static HashMap<String, ArrayList<String>> wqlMap = new HashMap<String, ArrayList<String>>();
|
public static HashMap<String, ArrayList<String>> wqlMap = new HashMap<String, ArrayList<String>>();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.modules.wql.core.db;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.wql.WQLCore;
|
import org.nl.modules.wql.WQLCore;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
@@ -168,8 +169,13 @@ public class DBConnection {
|
|||||||
if(null==name||"".equals(name)){
|
if(null==name||"".equals(name)){
|
||||||
name = WQLCore.defalutDBName;
|
name = WQLCore.defalutDBName;
|
||||||
}
|
}
|
||||||
DataSource dataSource = (DataSource) SpringContextHolder.getApplicationContext().getBean(name);
|
Object dataSource;
|
||||||
DataSourceUtils.releaseConnection(conn, dataSource);
|
try {
|
||||||
|
dataSource = SpringContextHolder.getApplicationContext().getBean(name);
|
||||||
|
}catch (NoSuchBeanDefinitionException ex){
|
||||||
|
dataSource = SpringContextHolder.getApplicationContext().getBean(DataSource.class);
|
||||||
|
}
|
||||||
|
DataSourceUtils.releaseConnection(conn, (DataSource) dataSource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.modules.wql.core.db;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.wql.WQLCore;
|
import org.nl.modules.wql.WQLCore;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||||
|
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
@@ -50,7 +51,7 @@ public class DBPoolSpring {
|
|||||||
static synchronized public DBPoolSpring getInstance(String name) {
|
static synchronized public DBPoolSpring getInstance(String name) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new DBPoolSpring();
|
instance = new DBPoolSpring();
|
||||||
// Connection conn = getConnection();
|
Connection conn = getConnection();
|
||||||
// if (conn !=null ){//&& ut !=null
|
// if (conn !=null ){//&& ut !=null
|
||||||
// setUseful (true);
|
// setUseful (true);
|
||||||
// }else{
|
// }else{
|
||||||
@@ -78,8 +79,13 @@ public class DBPoolSpring {
|
|||||||
public static Connection getConnection(String name) {
|
public static Connection getConnection(String name) {
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
Object bean;
|
||||||
conn = DataSourceUtils.getConnection(dataSource);
|
try {
|
||||||
|
bean = SpringContextHolder.getBean(name);
|
||||||
|
}catch (NoSuchBeanDefinitionException ex){
|
||||||
|
bean = SpringContextHolder.getBean(DataSource.class);
|
||||||
|
}
|
||||||
|
conn = DataSourceUtils.getConnection((DataSource) bean);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
||||||
}
|
}
|
||||||
@@ -115,15 +121,15 @@ public class DBPoolSpring {
|
|||||||
* @param conn 连接对象
|
* @param conn 连接对象
|
||||||
*/
|
*/
|
||||||
public static void freeConnection(Connection conn, String name) {
|
public static void freeConnection(Connection conn, String name) {
|
||||||
// try {
|
Object bean;
|
||||||
// if (conn != null) {
|
try {
|
||||||
// conn.close();
|
bean = SpringContextHolder.getBean(name);
|
||||||
// }
|
}catch (NoSuchBeanDefinitionException ex){
|
||||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
bean = SpringContextHolder.getBean(DataSource.class);
|
||||||
DataSourceUtils.releaseConnection(conn, dataSource);
|
}
|
||||||
// } catch (SQLException e) {
|
if (bean !=null){
|
||||||
// log.error("数据库连接关闭:"+e.toString() );
|
DataSourceUtils.releaseConnection(conn, (DataSource) bean);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InitialContext getInitialContext() throws NamingException {
|
private static InitialContext getInitialContext() throws NamingException {
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ import org.nl.modules.wql.core.engine.Syntax;
|
|||||||
import org.nl.modules.wql.exception.WDKException;
|
import org.nl.modules.wql.exception.WDKException;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.sql.DataSource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -45,11 +47,16 @@ public class WO implements Serializable, Cloneable{
|
|||||||
private static final long serialVersionUID = -4831486954013002791L;
|
private static final long serialVersionUID = -4831486954013002791L;
|
||||||
public WP wp;
|
public WP wp;
|
||||||
private String code = ""; //当前交易编号
|
private String code = ""; //当前交易编号
|
||||||
private String dbname = "dataSource"; //指定使用的数据库
|
private String dbname = "dataSource"; //指定使用的数据库;使用集群数据库时名字需要改成SpringContextHolder.getBean("shardingSphereDataSource")
|
||||||
|
|
||||||
public WO setDbname(String dbname) {
|
public WO setDbname(String dbname) {
|
||||||
this.dbname = dbname;
|
this.dbname = dbname;
|
||||||
Object bean = SpringContextHolder.getBean(dbname);
|
Object bean;
|
||||||
|
try {
|
||||||
|
bean = SpringContextHolder.getBean(dbname);
|
||||||
|
}catch (NoSuchBeanDefinitionException ex){
|
||||||
|
bean = SpringContextHolder.getBean(DataSource.class);
|
||||||
|
}
|
||||||
if(bean instanceof DruidDataSource) {
|
if(bean instanceof DruidDataSource) {
|
||||||
DruidDataSource druidDataSource = (DruidDataSource) bean;
|
DruidDataSource druidDataSource = (DruidDataSource) bean;
|
||||||
String rawJdbcUrl = druidDataSource.getRawJdbcUrl();
|
String rawJdbcUrl = druidDataSource.getRawJdbcUrl();
|
||||||
|
|||||||
@@ -6,10 +6,15 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shardingsphere.spring.boot.SpringBootConfiguration;
|
||||||
|
import org.apache.shardingsphere.spring.boot.datasource.DataSourceMapSetter;
|
||||||
|
import org.apache.shardingsphere.spring.boot.datasource.prop.impl.DataSourcePropertiesSetterHolder;
|
||||||
|
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
|
||||||
import org.nl.common.TableDataInfo;
|
import org.nl.common.TableDataInfo;
|
||||||
import org.nl.common.anno.Log;
|
import org.nl.common.anno.Log;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.common.utils.MapOf;
|
import org.nl.common.utils.MapOf;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.wms.storage_manage.pda.service.PdaStHrBcpInService;
|
import org.nl.wms.storage_manage.pda.service.PdaStHrBcpInService;
|
||||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.IStIvtIostorinvOrderService;
|
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.IStIvtIostorinvOrderService;
|
||||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dao.StIvtIostorinvOrder;
|
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dao.StIvtIostorinvOrder;
|
||||||
@@ -43,6 +48,8 @@ public class PdaStHrBcpOrderController {
|
|||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<Object> getMaterial(HrBcpIostorOrderQuery query, PageQuery page) {
|
public ResponseEntity<Object> getMaterial(HrBcpIostorOrderQuery query, PageQuery page) {
|
||||||
Page<StIvtIostorinvOrder> result = iStIvtIostorinvOrderService.page(page.build(), query.build());
|
Page<StIvtIostorinvOrder> result = iStIvtIostorinvOrderService.page(page.build(), query.build());
|
||||||
|
JSONObject jo = WQLObject.getWQLObject("sys_code_rule").query("code = '" + "IO_CODE" + "'").uniqueResult(0);
|
||||||
|
System.out.println(JSONObject.toJSONString(jo));
|
||||||
return new ResponseEntity<>(TableDataInfo.build(result), HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(result), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,54 +2,81 @@ server:
|
|||||||
port: 8011
|
port: 8011
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
autoconfigure:
|
||||||
druid:
|
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
shardingsphere:
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
enabled: true
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
datasource:
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
common:
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: ${DB_USER:root}
|
# 初始连接数
|
||||||
# password: ${DB_PWD:123456}
|
initial-size: 10
|
||||||
password: ${DB_PWD:942464Yy}
|
# 最小连接数
|
||||||
|
min-idle: 10
|
||||||
# 初始连接数
|
# 最大连接数
|
||||||
initial-size: 5
|
max-active: 100
|
||||||
# 最小连接数
|
# 是否自动回收超时连接
|
||||||
min-idle: 15
|
remove-abandoned: true
|
||||||
# 最大连接数
|
# 超时时间(以秒数为单位)
|
||||||
max-active: 30
|
remove-abandoned-timeout: 180
|
||||||
# 是否自动回收超时连接
|
# 获取连接超时时间
|
||||||
remove-abandoned: true
|
max-wait: 5000
|
||||||
# 超时时间(以秒数为单位)
|
# 连接有效性检测时间
|
||||||
remove-abandoned-timeout: 180
|
time-between-eviction-runs-millis: 60000
|
||||||
# 获取连接超时时间
|
# 连接在池中最小生存的时间
|
||||||
max-wait: 3000
|
min-evictable-idle-time-millis: 300000
|
||||||
# 连接有效性检测时间
|
# 连接在池中最大生存的时间
|
||||||
time-between-eviction-runs-millis: 60000
|
max-evictable-idle-time-millis: 900000
|
||||||
# 连接在池中最小生存的时间
|
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||||
min-evictable-idle-time-millis: 300000
|
test-while-idle: true
|
||||||
# 连接在池中最大生存的时间
|
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||||
max-evictable-idle-time-millis: 900000
|
test-on-borrow: true
|
||||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
# 是否在归还到池中前进行检验
|
||||||
test-while-idle: true
|
test-on-return: false
|
||||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
# 检测连接是否有效
|
||||||
test-on-borrow: true
|
validation-query: select 1
|
||||||
# 是否在归还到池中前进行检验
|
# 配置监控统计
|
||||||
test-on-return: false
|
webStatFilter:
|
||||||
# 检测连接是否有效
|
enabled: true
|
||||||
validation-query: select 1
|
stat-view-servlet:
|
||||||
# 配置监控统计
|
enabled: true
|
||||||
webStatFilter:
|
url-pattern: /druid/*
|
||||||
enabled: true
|
reset-enable: false
|
||||||
stat-view-servlet:
|
filters:
|
||||||
enabled: true
|
DruidFilter,stat
|
||||||
url-pattern: /druid/*
|
names: master,slave
|
||||||
reset-enable: false
|
master:
|
||||||
filters:
|
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||||
DruidFilter,stat
|
username: ${DB_USER:root}
|
||||||
|
password: ${DB_PWD:942464Yy}
|
||||||
|
slave:
|
||||||
|
url: jdbc:mysql://${DB_HOST:192.168.81.165}:${DB_PORT:3306}/${DB_NAME:hl_one_mes2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||||
|
username: ${DB_USER:root}
|
||||||
|
password: ${DB_PWD:password}
|
||||||
|
rules:
|
||||||
|
replica-query:
|
||||||
|
data-sources:
|
||||||
|
db:
|
||||||
|
# 读写分离类型,比如:Static,Dynamic
|
||||||
|
type: Static
|
||||||
|
#主数据源名称
|
||||||
|
primary-data-source-name: master
|
||||||
|
#从数据源名称,多个用逗号分隔
|
||||||
|
replica-data-source-names: slave
|
||||||
|
#负载均衡算法名称
|
||||||
|
load-balancer-name: round-robin
|
||||||
|
props:
|
||||||
|
#接口有事务,读写分离不生效,默认全部使用主库
|
||||||
|
write-data-source-name: master
|
||||||
|
read-data-source-names: slave
|
||||||
|
load-balancers:
|
||||||
|
round-robin:
|
||||||
|
#负载均衡算法配置,一共三种一种是 RANDOM(随机),一种是 ROUND_ROBIN(轮询),一种是 WEIGHT(权重)
|
||||||
|
type: ROUND_ROBIN
|
||||||
|
props:
|
||||||
|
#负载均衡算法属性配置
|
||||||
|
workId: 1
|
||||||
redis:
|
redis:
|
||||||
#数据库索引
|
#数据库索引
|
||||||
database: ${REDIS_DB:1}
|
database: ${REDIS_DB:1}
|
||||||
|
|||||||
Reference in New Issue
Block a user