Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lei
fzm-joying
Commits
edff9f7d
Commit
edff9f7d
authored
Jul 12, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
引入sharding-jdbc,加入读写分离配置
parent
b8ca93b7
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
179 additions
and
120 deletions
+179
-120
application-dev.yml
joying-admin/src/main/resources/application-dev.yml
+27
-21
application-local.yml
joying-admin/src/main/resources/application-local.yml
+27
-21
application-test.yml
joying-admin/src/main/resources/application-test.yml
+27
-21
pom.xml
joying-common/pom.xml
+5
-0
application-dev.yml
joying-portal/src/main/resources/application-dev.yml
+27
-19
application-local.yml
joying-portal/src/main/resources/application-local.yml
+27
-19
application-test.yml
joying-portal/src/main/resources/application-test.yml
+27
-19
pom.xml
pom.xml
+12
-0
No files found.
joying-admin/src/main/resources/application-dev.yml
View file @
edff9f7d
server
:
server
:
port
:
8002
port
:
8002
spring
:
spring
:
application
:
name
:
joying-admin
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
172.16.101.135
host
:
172.16.101.135
port
:
6379
port
:
6379
...
...
joying-admin/src/main/resources/application-local.yml
View file @
edff9f7d
server
:
server
:
port
:
8002
port
:
8002
spring
:
spring
:
application
:
name
:
joying-admin
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
172.16.101.135
host
:
172.16.101.135
port
:
6379
port
:
6379
...
...
joying-admin/src/main/resources/application-test.yml
View file @
edff9f7d
server
:
server
:
port
:
8002
port
:
8002
spring
:
spring
:
application
:
name
:
joying-admin
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
172.16.101.136
host
:
172.16.101.136
port
:
6379
port
:
6379
...
...
joying-common/pom.xml
View file @
edff9f7d
...
@@ -88,6 +88,11 @@
...
@@ -88,6 +88,11 @@
<groupId>
com.google.zxing
</groupId>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<artifactId>
core
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.shardingsphere
</groupId>
<artifactId>
sharding-jdbc-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
</dependencies>
<properties>
<properties>
...
...
joying-portal/src/main/resources/application-dev.yml
View file @
edff9f7d
...
@@ -2,30 +2,38 @@ server:
...
@@ -2,30 +2,38 @@ server:
port
:
8001
port
:
8001
spring
:
spring
:
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
172.16.101.135
host
:
172.16.101.135
port
:
6379
port
:
6379
...
...
joying-portal/src/main/resources/application-local.yml
View file @
edff9f7d
...
@@ -2,30 +2,38 @@ server:
...
@@ -2,30 +2,38 @@ server:
port
:
8001
port
:
8001
spring
:
spring
:
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
localhost
host
:
localhost
port
:
6379
port
:
6379
...
...
joying-portal/src/main/resources/application-test.yml
View file @
edff9f7d
...
@@ -2,30 +2,38 @@ server:
...
@@ -2,30 +2,38 @@ server:
port
:
8001
port
:
8001
spring
:
spring
:
main
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
names
:
write,read
# 主数据源
write
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.135:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
username
:
root
password
:
Joying@123456
password
:
Joying@123456
platform
:
mysql
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
url
:
jdbc:mysql://172.16.101.136:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
initial-size
:
5
username
:
root
min-idle
:
5
password
:
Joying@123456
max-active
:
20
masterslave
:
max-wait
:
60000
# 读写分离配置
time-between-eviction-runs-millis
:
60000
load-balance-algorithm-type
:
round_robin
min-evictable-idle-time-millis
:
300000
# 最终的数据源名称
validation-query
:
SELECT 1 FROM DUAL
name
:
dataSource
test-while-idle
:
true
# 主库数据源名称
test-on-borrow
:
fals
e
master-data-source-name
:
writ
e
test-on-return
:
false
# 从库数据源名称列表,多个逗号分隔
pool-prepared-statements
:
false
slave-data-source-names
:
read
max-pool-prepared-statement-per-connection-size
:
20
props
:
filters
:
stat ,wall
# 开启SQL显示,默认false
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
sql
:
useGlobalDataSourceStat
:
true
show
:
true
redis
:
redis
:
host
:
172.16.101.136
host
:
172.16.101.136
port
:
6379
port
:
6379
...
...
pom.xml
View file @
edff9f7d
...
@@ -99,6 +99,18 @@
...
@@ -99,6 +99,18 @@
<artifactId>
core
</artifactId>
<artifactId>
core
</artifactId>
<version>
3.3.0
</version>
<version>
3.3.0
</version>
</dependency>
</dependency>
<!-- sharding -->
<dependency>
<groupId>
org.apache.shardingsphere
</groupId>
<artifactId>
sharding-jdbc-spring-boot-starter
</artifactId>
<version>
4.0.0-RC1
</version>
<exclusions>
<exclusion>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment