读写分离-sharding-归并排序优化
This commit is contained in:
@@ -3,7 +3,7 @@ spring:
|
||||
dynamic-datasource:
|
||||
master:
|
||||
poolName: master
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -15,7 +15,7 @@ spring:
|
||||
max-lifetime: 7000
|
||||
slave:
|
||||
poolName: slave
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
@@ -3,7 +3,7 @@ spring:
|
||||
dynamic-datasource:
|
||||
master:
|
||||
poolName: master
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -15,7 +15,7 @@ spring:
|
||||
max-lifetime: 7000
|
||||
slave:
|
||||
poolName: slave
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.accompany.sharding.config;
|
||||
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.common.utils.EnvComponent;
|
||||
import com.accompany.common.utils.ResourceUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
@@ -41,6 +42,9 @@ import java.util.*;
|
||||
@Configuration
|
||||
public class ShardingSphereConfig {
|
||||
|
||||
@Autowired
|
||||
private EnvComponent envComponent;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("masterDataSource")
|
||||
private DataSource masterDataSource;
|
||||
@@ -64,6 +68,8 @@ public class ShardingSphereConfig {
|
||||
//是否打印执行的sql语句
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("sql-show", "false");
|
||||
properties.setProperty("query-with-cursor", "true");
|
||||
properties.setProperty("max-connections-size-per-query", "8");
|
||||
|
||||
return ShardingSphereDataSourceFactory.createDataSource(modeConfig, dataSourceMap, ruleConfigs, properties);
|
||||
}
|
||||
|
@@ -111,8 +111,8 @@
|
||||
from bill_record r
|
||||
where
|
||||
r.uid = #{uid}
|
||||
and r.create_time >= #{startTime} and r.create_time <= #{endTime}
|
||||
and r.currency = #{currencyType}
|
||||
and r.create_time between #{startTime} and #{endTime}
|
||||
<if test="null != billType">
|
||||
and r.bill_type = #{billType}
|
||||
</if>
|
||||
|
@@ -3,7 +3,7 @@ spring:
|
||||
dynamic-datasource:
|
||||
master:
|
||||
poolName: master
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -13,21 +13,21 @@ spring:
|
||||
maximum-pool-size: 16
|
||||
connection-test-query: select 1
|
||||
max-lifetime: 1800000 # 30分钟
|
||||
validation-timeout: 3000 # 验证连接的最大等待时间
|
||||
validation-timeout: 6000 # 验证连接的最大等待时间
|
||||
idle-timeout: 600000 # 空闲连接超时时间(10分钟)
|
||||
slave:
|
||||
poolName: slave
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
minimum-idle: 4
|
||||
maximum-pool-size: 16
|
||||
maximum-pool-size: 32
|
||||
connection-test-query: select 1
|
||||
max-lifetime: 1800000 # 30分钟
|
||||
validation-timeout: 3000 # 验证连接的最大等待时间
|
||||
validation-timeout: 6000 # 验证连接的最大等待时间
|
||||
idle-timeout: 600000 # 空闲连接超时时间(10分钟)
|
||||
redis:
|
||||
host: 124.156.164.187
|
||||
|
@@ -3,7 +3,7 @@ spring:
|
||||
dynamic-datasource:
|
||||
master:
|
||||
poolName: master
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -15,7 +15,7 @@ spring:
|
||||
max-lifetime: 7000
|
||||
slave:
|
||||
poolName: slave
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
@@ -3,7 +3,7 @@ spring:
|
||||
dynamic-datasource:
|
||||
master:
|
||||
poolName: master
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -15,7 +15,7 @@ spring:
|
||||
max-lifetime: 7000
|
||||
slave:
|
||||
poolName: slave
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false
|
||||
jdbcUrl: jdbc:mysql://124.156.164.187:3306/peko?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false&useSSL=false&useCursorFetch=true
|
||||
username: root
|
||||
password: anan@dev##
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
Reference in New Issue
Block a user