# 应用名称 spring.application.name=sharging-jdbc-demo # 开发环境设置 spring.profiles.active=dev # 内存模式 spring.shardingsphere.mode.type=Memory # 配置真实数据源 spring.shardingsphere.datasource.names=server-order,server-user # 配置第 1 个数据源 spring.shardingsphere.datasource.server-user.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.server-user.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.server-user.jdbc-url=jdbc:mysql://192.168.100.201:3301/db_user spring.shardingsphere.datasource.server-user.username=root spring.shardingsphere.datasource.server-user.password=123456 # 配置第 2 个数据源 spring.shardingsphere.datasource.server-order.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.server-order.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.server-order.jdbc-url=jdbc:mysql://192.168.100.201:3302/db_order spring.shardingsphere.datasource.server-order.username=root spring.shardingsphere.datasource.server-order.password=123456 # 标准分片表配置 # 由数据源名 + 表名组成,以小数点分隔。多个表以逗号分隔,支持 inline 表达式。缺省表示使用已知数据源与逻辑表名称生成数据节点,用于广播表(即每个库中都需要一个同样的表用于关联查询,多为字典表)或只分库不分表且所有库的表结构完全一致的情况 spring.shardingsphere.rules.sharding.tables.t_user.actual-data-nodes=server-user.t_user spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=server-order.t_order # 打印SQl spring.shardingsphere.props.sql-show=true