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
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
209 additions
and
150 deletions
+209
-150
application-dev.yml
joying-admin/src/main/resources/application-dev.yml
+32
-26
application-local.yml
joying-admin/src/main/resources/application-local.yml
+32
-26
application-test.yml
joying-admin/src/main/resources/application-test.yml
+32
-26
pom.xml
joying-common/pom.xml
+5
-0
application-dev.yml
joying-portal/src/main/resources/application-dev.yml
+32
-24
application-local.yml
joying-portal/src/main/resources/application-local.yml
+32
-24
application-test.yml
joying-portal/src/main/resources/application-test.yml
+32
-24
pom.xml
pom.xml
+12
-0
No files found.
joying-admin/src/main/resources/application-dev.yml
View file @
edff9f7d
server
:
port
:
8002
spring
:
application
:
name
:
joying-admin
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
172.16.101.135
port
:
6379
...
...
joying-admin/src/main/resources/application-local.yml
View file @
edff9f7d
server
:
port
:
8002
spring
:
application
:
name
:
joying-admin
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
172.16.101.135
port
:
6379
...
...
joying-admin/src/main/resources/application-test.yml
View file @
edff9f7d
server
:
port
:
8002
spring
:
application
:
name
:
joying-admin
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
172.16.101.136
port
:
6379
...
...
joying-common/pom.xml
View file @
edff9f7d
...
...
@@ -88,6 +88,11 @@
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.shardingsphere
</groupId>
<artifactId>
sharding-jdbc-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
<properties>
...
...
joying-portal/src/main/resources/application-dev.yml
View file @
edff9f7d
...
...
@@ -2,30 +2,38 @@ server:
port
:
8001
spring
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
172.16.101.135
port
:
6379
...
...
joying-portal/src/main/resources/application-local.yml
View file @
edff9f7d
...
...
@@ -2,30 +2,38 @@ server:
port
:
8001
spring
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
localhost
port
:
6379
...
...
joying-portal/src/main/resources/application-test.yml
View file @
edff9f7d
...
...
@@ -2,30 +2,38 @@ server:
port
:
8001
spring
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.136:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
allow-bean-definition-overriding
:
true
shardingsphere
:
datasource
:
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
password
:
Joying@123456
# 从数据源
read
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://172.16.101.136:3306/joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
Joying@123456
masterslave
:
# 读写分离配置
load-balance-algorithm-type
:
round_robin
# 最终的数据源名称
name
:
dataSource
# 主库数据源名称
master-data-source-name
:
write
# 从库数据源名称列表,多个逗号分隔
slave-data-source-names
:
read
props
:
# 开启SQL显示,默认false
sql
:
show
:
true
redis
:
host
:
172.16.101.136
port
:
6379
...
...
pom.xml
View file @
edff9f7d
...
...
@@ -99,6 +99,18 @@
<artifactId>
core
</artifactId>
<version>
3.3.0
</version>
</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>
</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