1 Star 4 Fork 1

xcc/sharding-jdbc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
application_maslave.properties 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
#主从数据库
server.port=56081
spring.application.name=sharding‐jdbc-demo
server.servlet.context‐path=/sharding‐jdbc-demo
#编码
spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8
spring.http.encoding.force=true
spring.main.allow-bean-definition-overriding=true
#将数据库的_字段自动映射为驼峰
mybatis.configuration.map-underscore-to-camel-case=true
# 打开sql输出日志
spring.shardingsphere.props.sql.show=true
swagger.enable=true
#log日志配置
logging.level.root=info
logging.level.org.springframework.web=info
logging.level.com.xcc.dbsharding=debug
logging.level.druid.sql=debug
#sharding-jdbc分片规则配置
#数据源 主从
spring.shardingsphere.datasource.names=m0,s0
#数据源m0 连接user_db数据库
spring.shardingsphere.datasource.m0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.m0.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.m0.url=jdbc:mysql://localhost:3306/user_db?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.m0.username=root
spring.shardingsphere.datasource.m0.password=123456
#数据源m0 连接user_db数据库
spring.shardingsphere.datasource.s0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.s0.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.s0.url=jdbc:mysql://localhost:3307/user_db?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.shardingsphere.datasource.s0.username=root
spring.shardingsphere.datasource.s0.password=123456
# 主库从库逻辑数据源定义 ds0为user_db
spring.shardingsphere.sharding.master‐slave‐rules.ds0.master-data-source-name=m0
spring.shardingsphere.sharding.master‐slave‐rules.ds0.slave-data-source-names=s0
# t_user分表策略 固定分配至ds0的t_user真实表
spring.shardingsphere.sharding.tables.t_user.actual-data-nodes=ds0.t_user
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/xiaocheng0902/sharding-jdbc.git
git@gitee.com:xiaocheng0902/sharding-jdbc.git
xiaocheng0902
sharding-jdbc
sharding-jdbc
master

搜索帮助

Dd8185d8 1850385 E526c682 1850385