johnny2002 edited a comment on issue #7471:
URL: https://github.com/apache/shardingsphere/issues/7471#issuecomment-693187128
> Hi @johnny2002
> `actual-data-nodes` expresses the positions of actual tables. In general,
`logic_table_a` and `logic_table_b` have the same table rule though, the
`actual-data-nodes` is different, right?
>
> BTW, `defaultTableRule` seems to fit your case. What do you think? Plus,
we gave a huge improvement in the upcoming 5.x release configuration, like the
following example.
>
> ```yaml
> schemaName: sharding_db
>
> dataSourceCommon:
> username: root
> password:
> connectionTimeoutMilliseconds: 30000
> idleTimeoutMilliseconds: 60000
> maxLifetimeMilliseconds: 1800000
> maxPoolSize: 50
> minPoolSize: 1
> maintenanceIntervalMilliseconds: 30000
>
> dataSources:
> ds_0:
> url:
jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
> ds_1:
> url:
jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
>
> rules:
> - !SHARDING
> tables:
> t_order:
> actualDataNodes: ds_${0..1}.t_order_${0..1}
> tableStrategy:
> standard:
> shardingColumn: order_id
> shardingAlgorithmName: t_order_inline
> keyGenerateStrategy:
> column: order_id
> keyGeneratorName: snowflake
> t_order_item:
> actualDataNodes: ds_${0..1}.t_order_item_${0..1}
> tableStrategy:
> standard:
> shardingColumn: order_id
> shardingAlgorithmName: t_order_item_inline
> keyGenerateStrategy:
> column: order_item_id
> keyGeneratorName: snowflake
> bindingTables:
> - t_order,t_order_item
> defaultDatabaseStrategy:
> standard:
> shardingColumn: user_id
> shardingAlgorithmName: database_inline
> defaultTableStrategy:
> none:
>
> shardingAlgorithms:
> database_inline:
> type: INLINE
> props:
> algorithm-expression: ds_${user_id % 2}
> t_order_inline:
> type: INLINE
> props:
> algorithm-expression: t_order_${order_id % 2}
> t_order_item_inline:
> type: INLINE
> props:
> algorithm-expression: t_order_item_${order_id % 2}
>
> keyGenerators:
> snowflake:
> type: SNOWFLAKE
> props:
> worker-id: 123
> ```
Hi Trista,
1. actual-data-nodes expresses the positions of actual tables. In general,
logic_table_a and logic_table_b have the same table rule though, the
actual-data-nodes is different, right?
【Exactly, Yes】
2. defaultTableRule seems to fit your case
【No, defaultTableRule only has one, while I have some different sharding
rules】
In my real case, some tables sharding by column "customer_id", some tables
sharding by date. even sharding by same column, while they may have different
slices. For reference tables and parameter tables, no sharding.
Even some tables sharding with same column, while the sub-tables count may
not be same.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]