databaseName: sharding_db
dataSources:
ds0:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://172.20.72.112:3306/ds0?characterEncoding=UTF8&autoReconnect=true&useSSL=false
username: test
password: Info1234
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds1:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://172.20.72.112:3306/ds1?characterEncoding=UTF8&autoReconnect=true&useSSL=false
username: test
password: Info1234
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SHARDING
tables:
t_order:
actualDataNodes: ds${0..1}.t_order${1..2}
databaseStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: database_inline
tableStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: table_inline
# keyGenerateStrategy:
# column: order_master_id
# keyGeneratorName: snowflake
# bindingTables:
# - t_order
# broadcastTables:
# - t_address
# defaultDatabaseStrategy:
# standard:
# shardingColumn: user_id
# shardingAlgorithmName: database_inline
# defaultTableStrategy:
# none:
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: ds${user_id % 2}
table_inline:
type: INLINE
props:
algorithm-expression: t_order${order_id % 2}
# t_order_inline:
# type: INLINE
# props:
# algorithm-expression: t_order
# t_order_item_inline:
# type: INLINE
# props:
# algorithm-expression: t_order_item
keyGenerators:
snowflake:
type: SNOWFLAKE
是不是说反了? 从截图看输出了 plain 和 cipher 字段,这应该是 actual sql。
逻辑 SQL 是用户输入的原始 SQL,升级到新的版本就可以了。 5.1.2 还没有这个能力。
我确实是想获取t_order1(实际表的createsql),不支持的话就没办法了,感谢解答。