build: 构建生产环境配置

This commit is contained in:
xiongxiaoyang 2025-03-15 17:25:10 +08:00
parent af1237e2d7
commit 81c1514a21
13 changed files with 26 additions and 119 deletions

View File

@ -34,7 +34,7 @@ rules:
tableStrategy: tableStrategy:
standard: standard:
# 分片列名称 # 分片列名称
shardingColumn: chapter_id shardingColumn: index_id
# 分片算法名称 # 分片算法名称
shardingAlgorithmName: bookContentSharding shardingAlgorithmName: bookContentSharding
@ -44,7 +44,7 @@ rules:
type: INLINE type: INLINE
props: props:
# 分片算法的行表达式 # 分片算法的行表达式
algorithm-expression: book_content${chapter_id % 10} algorithm-expression: book_content${index_id % 10}

View File

@ -284,6 +284,11 @@
<include name="*.*"/> <include name="*.*"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${project.build.directory}/build/config" overwrite="true">
<fileset dir="${basedir}/../config">
<include name="*.*"/>
</fileset>
</copy>
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
tofile="${project.build.directory}/build/${project.artifactId}.jar"/> tofile="${project.build.directory}/build/${project.artifactId}.jar"/>

View File

@ -2,19 +2,8 @@
server: server:
port: 8088 port: 8088
spring: spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: test123456 password: test123456
sharding:
jdbc:
datasource:
ds0:
jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456

View File

@ -7,9 +7,6 @@ logging:
root: info root: info
com.java2nb: debug com.java2nb: debug
spring: spring:
datasource:
driverClassName: org.apache.shardingsphere.driver.ShardingSphereDriver
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379

View File

@ -7,9 +7,6 @@ logging:
root: error root: error
com.java2nb: error com.java2nb: error
spring: spring:
datasource:
driverClassName: org.apache.shardingsphere.driver.ShardingSphereDriver
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379

View File

@ -9,6 +9,9 @@ server:
# basic: # basic:
# enabled: false # enabled: false
spring: spring:
datasource:
driverClassName: org.apache.shardingsphere.driver.ShardingSphereDriver
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
thymeleaf: thymeleaf:
mode: LEGACYHTML5 mode: LEGACYHTML5
cache: false cache: false

View File

@ -10,21 +10,8 @@ spring:
port: 6379 port: 6379
#Redis服务器连接密码 #Redis服务器连接密码
password: test123456 password: test123456
jedis:
pool:
#连接池最大连接数使用负值表示没有限制
max-active: 8
#连接池最大阻塞等待时间使用负值表示没有限制
max-wait: 1
#连接池最大阻塞等待时间使用负值表示没有限制
max-idle: 8
#连接池中的最小空闲连接
min-idle: 0
#连接超时时间毫秒 #连接超时时间毫秒
timeout: 30000 timeout: 10000
datasource:
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
content: content:
save: save:

View File

@ -9,63 +9,8 @@ spring:
#Redis服务器连接端口 #Redis服务器连接端口
port: 6379 port: 6379
#Redis服务器连接密码 #Redis服务器连接密码
password: test
jedis:
pool:
#连接池最大连接数使用负值表示没有限制
max-active: 8
#连接池最大阻塞等待时间使用负值表示没有限制
max-wait: 1
#连接池最大阻塞等待时间使用负值表示没有限制
max-idle: 8
#连接池中的最小空闲连接
min-idle: 0
#连接超时时间毫秒
timeout: 30000
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_biz?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456 password: test123456
driver-class-name: com.mysql.cj.jdbc.Driver timeout: 10000
####使用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/novel_plus2
# 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}
logging: logging:
level: level:

View File

@ -1,4 +1,7 @@
spring: spring:
datasource:
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
cache: cache:
ehcache: ehcache:
config: classpath:ehcache.xml config: classpath:ehcache.xml

View File

@ -63,6 +63,11 @@
<include name="*.*"/> <include name="*.*"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${project.build.directory}/build/config" overwrite="true">
<fileset dir="${basedir}/../config">
<include name="*.*"/>
</fileset>
</copy>
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
tofile="${project.build.directory}/build/${project.artifactId}.jar"/> tofile="${project.build.directory}/build/${project.artifactId}.jar"/>

View File

@ -4,26 +4,11 @@ server:
#不分表的数据库配置 #不分表的数据库配置
spring: spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: test123456 password: test123456
####使用shardingJdbc时
####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误
##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR
sharding:
jdbc:
datasource:
ds0:
jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
#登录用户名密码 #登录用户名密码
admin: admin:
username: admin username: admin

View File

@ -84,6 +84,11 @@
<include name="application-website.yml"/> <include name="application-website.yml"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${project.build.directory}/build/config" overwrite="true">
<fileset dir="${basedir}/../config">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${project.build.directory}/build/templates" overwrite="true"> <copy todir="${project.build.directory}/build/templates" overwrite="true">
<fileset dir="${basedir}/../templates"> <fileset dir="${basedir}/../templates">
<include name="**/*.*"/> <include name="**/*.*"/>

View File

@ -4,25 +4,11 @@ server:
#不分表的数据库配置 #不分表的数据库配置
spring: spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: test123456 password: test123456
####使用shardingJdbc时
####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误
##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR
sharding:
jdbc:
datasource:
ds0:
jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
pic: pic:
save: save: