方便更快捷的说明问题,可以按需填写(可删除)
使用环境:
版本 5.1.1 , jdk 1.8
场景、问题:
某一逻辑表希望同时支持strandard策略及hint分片策略,不同场景使用
已进行操作:
配置如下
spring:
shardingsphere:
rules:
sharding:
tables:
#1. hint分片策略
** test_table_name:**
** actual-data-nodes: totalds.test_table_name_$->{0…(${tab.parent.num} - 1)}**
** table-strategy:**
** hint:**
** sharding-algorithm-name: hint-sharding-algorithm**
** database-strategy:**
** hint:**
** sharding-algorithm-name: hint-db-sharding-algorithm**
** # 2. 要求同时标准分片策略**
** test_table_name:**
** actual-data-nodes: totalds.test_table_name_$->{0…(${tab.parent.num} - 1)}**
** table-strategy:**
** standard:**
** sharding-column: uid**
** sharding-algorithm-name: algorithm-uid-inline**
现状:
spring:
shardingsphere:
rules:
sharding:
tables:
#1. hint分片策略
test_table_name:
actual-data-nodes: totalds.test_table_name_$->{0…(${tab.parent.num} - 1)}
table-strategy:
hint:
sharding-algorithm-name: hint-sharding-algorithm
database-strategy:
hint:
sharding-algorithm-name: hint-db-sharding-algorithm