shards-jdbc分库分表实例

时间:2023-02-06 03:59:31
【文件属性】:

文件名称:shards-jdbc分库分表实例

文件大小:4KB

文件格式:7Z

更新时间:2023-02-06 03:59:31

分库分表

shards-jdbc分库分表实例 dataSources: ds0: !!org.apache.commons.dbcp.BasicDataSource driverClassName: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/ds0 username: root password: ds1: !!org.apache.commons.dbcp.BasicDataSource driverClassName: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/ds1 username: root password: shardingRule: tables: t_order: actualDataNodes: ds${0..1}.t_order${0..1} tableStrategy: inline: shardingColumn: order_id algorithmExpression: t_order${order_id % 2} keyGenerator: type: SNOWFLAKE column: order_id t_order_item: actualDataNodes: ds${0..1}.t_order_item${0..1} tableStrategy: inline: shardingColumn: order_id algorithmExpression: t_order_item${order_id % 2} bindingTables: - t_order,t_order_item broadcastTables: - t_config defaultDataSourceName: ds0 defaultDatabaseStrategy: inline: shardingColumn: user_id algorithmExpression: ds${user_id % 2} defaultTableStrategy: none: defaultKeyGenerator: type: SNOWFLAKE props: sql.show: true


【文件预览】:
src
----test()
--------resources()
--------java()
----main()
--------scripts()
--------resources()
--------java()
pom.xml

网友评论