mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-01 15:26:37 +00:00
98 lines
3.5 KiB
Java
98 lines
3.5 KiB
Java
java2nb:
|
||
uploadPath: /var/pic/
|
||
username: admin
|
||
password: 111111
|
||
logging:
|
||
level:
|
||
root: info
|
||
com.java2nb: debug
|
||
spring:
|
||
datasource:
|
||
type: com.alibaba.druid.pool.DruidDataSource
|
||
driverClassName: com.mysql.cj.jdbc.Driver
|
||
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||
username: root
|
||
password: test123456
|
||
#password:
|
||
initialSize: 1
|
||
minIdle: 3
|
||
maxActive: 20
|
||
# 配置获取连接等待超时的时间
|
||
maxWait: 60000
|
||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||
timeBetweenEvictionRunsMillis: 60000
|
||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||
minEvictableIdleTimeMillis: 30000
|
||
validationQuery: select 'x'
|
||
testWhileIdle: true
|
||
testOnBorrow: false
|
||
testOnReturn: false
|
||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||
poolPreparedStatements: true
|
||
maxPoolPreparedStatementPerConnectionSize: 20
|
||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||
filters: stat,slf4j
|
||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||
# 合并多个DruidDataSource的监控数据
|
||
#useGlobalDataSourceStat: true
|
||
redis:
|
||
host: 127.0.0.1
|
||
port: 6379
|
||
password: test123456
|
||
# 连接超时时间(毫秒)
|
||
timeout: 10000
|
||
jedis:
|
||
pool:
|
||
# 连接池中的最大空闲连接
|
||
max-idle: 8
|
||
# 连接池中的最小空闲连接
|
||
min-idle: 10
|
||
# 连接池最大连接数(使用负值表示没有限制)
|
||
max-active: 100
|
||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||
max-wait: -1
|
||
|
||
|
||
|
||
####使用shardingJdbc时,
|
||
####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误
|
||
##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR
|
||
|
||
sharding:
|
||
jdbc:
|
||
datasource:
|
||
names: ds0,ds1
|
||
ds0:
|
||
type: com.zaxxer.hikari.HikariDataSource
|
||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||
jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||
username: root
|
||
password: test123456
|
||
ds1:
|
||
type: com.alibaba.druid.pool.DruidDataSource
|
||
driver-class-name: com.mysql.jdbc.Driver
|
||
url: jdbc:mysql://localhost:3306/information_schema?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||
username: root
|
||
password: test123456
|
||
config:
|
||
sharding:
|
||
props:
|
||
sql.show: true
|
||
tables:
|
||
book_content: #book_content表
|
||
key-generator-column-name: id #主键
|
||
actual-data-nodes: ds${0}.book_content${0..9} #数据节点
|
||
# database-strategy: #分库策略
|
||
# inline:
|
||
# sharding-column: book_id
|
||
# algorithm-expression: ds${book_id % 10}
|
||
table-strategy: #分表策略
|
||
inline:
|
||
shardingColumn: index_id
|
||
algorithm-expression: book_content${index_id % 10}
|
||
tables:
|
||
actual-data-nodes: ds${1}.tables
|
||
columns:
|
||
actual-data-nodes: ds${1}.columns
|
||
default-data-source-name: ds0 |