mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
默认开启分表功能(适用于新用户),通过添加配置spring.autoconfigure.exclude=io.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration来关闭分表功能(适用于老用户升级)
This commit is contained in:
parent
7a6d7a4442
commit
b193aca288
@ -28,43 +28,42 @@ spring:
|
|||||||
password: test123456
|
password: test123456
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
|
||||||
####使用shardingJdbc时,
|
####使用shardingJdbc时,
|
||||||
####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误
|
####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误
|
||||||
##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR
|
##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR
|
||||||
|
|
||||||
#sharding:
|
sharding:
|
||||||
# jdbc:
|
jdbc:
|
||||||
# datasource:
|
datasource:
|
||||||
# names: ds0 #,ds1
|
names: ds0 #,ds1
|
||||||
# ds0:
|
ds0:
|
||||||
# type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
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
|
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
|
# username: root
|
||||||
# password: test123456
|
# password: test123456
|
||||||
## ds1:
|
config:
|
||||||
## type: com.alibaba.druid.pool.DruidDataSource
|
sharding:
|
||||||
## driver-class-name: com.mysql.jdbc.Driver
|
props:
|
||||||
## url: jdbc:mysql://localhost:3306/novel_plus2
|
sql.show: true
|
||||||
## username: root
|
tables:
|
||||||
## password: test123456
|
book_content: #book_content表
|
||||||
# config:
|
key-generator-column-name: id #主键
|
||||||
# sharding:
|
actual-data-nodes: ds${0}.book_content${0..9} #数据节点
|
||||||
# props:
|
# database-strategy: #分库策略
|
||||||
# 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:
|
# inline:
|
||||||
# shardingColumn: index_id
|
# sharding-column: book_id
|
||||||
# algorithm-expression: book_content${index_id % 10}
|
# algorithm-expression: ds${book_id % 10}
|
||||||
|
table-strategy: #分表策略
|
||||||
|
inline:
|
||||||
|
shardingColumn: index_id
|
||||||
|
algorithm-expression: book_content${index_id % 10}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.java2nb.novel;
|
package com.java2nb.novel;
|
||||||
|
|
||||||
import io.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration;
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@ -11,7 +10,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = {SpringBootConfiguration.class})
|
@SpringBootApplication
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@ServletComponentScan
|
@ServletComponentScan
|
||||||
|
@ -16,7 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = {SpringBootConfiguration.class})
|
@SpringBootApplication
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
|
Loading…
x
Reference in New Issue
Block a user