-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.yml
123 lines (118 loc) · 3.73 KB
/
application.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
server:
port: 9090
spring:
application:
name: sharding_jdbc
datasource:
initialSize: 10
minIdle: 10
maxActive: 200
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 30000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 数据库是否加密
db:
pwd:
encrypt: true
#sharding-jdbc的配置
#一主多从配置
sharding.jdbc:
datasource:
names: ds_master,ds_slave_0,ds_slave_1
ds_master:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/db1
username: root
password: cm9vdA==
initialSize: 10
ds_slave_0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/db0
username: root
password: cm9vdA==
ds_slave_1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/db2
username: root
password: cm9vdA==
config:
masterslave:
name: ds_ms
master-data-source-name: ds_master
slave-data-source-names: ds_slave_0,ds_slave_1
load-balance-algorithm-type: RANDOM
props:
sql.show: true
#多主多从配置
#sharding.jdbc:
# datasource:
# names: ds_master_0,ds_slave_0,ds_master_1,ds_slave_1
# ds_master_0:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://localhost:3306/db1
# username: root
# password: root
# ds_slave_0:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://localhost:3306/db0
# username: root
# password: root
# ds_master_1:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://localhost:3306/db3
# username: root
# password: root
# ds_slave_1:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://localhost:3306/db2
# username: root
# password: root
# config:
# sharding:
# tables:
# # 数据库表名
# user:
# actual-data-nodes: ds$->{0..1}.user
# table-strategy:
# inline:
# sharding-column: id
# algorithm-expression: user
# #自增列名称,缺省表示不使用自增主键生成器
# key-generator-column-name: id
# #默认自增列值生成器类名称,缺省使用DefaultKeyGenerator
# key-generator-class-name: io.shardingsphere.core.keygen.DefaultKeyGenerator
# master-slave-rules:
# ds0:
# master-data-source-name: ds_master_0
# slave-data-source-names: ds_slave_0
# ds1:
# master-data-source-name: ds_master_1
# slave-data-source-names: ds_slave_1
# props:
# sql.show: true
#mybatis的配置
mybatis:
config-location: classpath:mybatis/config.xml
mapper-locations:
- classpath:mybatis/mappers/*.xml