Logo
Sharding

Sharding #

Configuration Item Explanation #

Namespace: http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding-5.1.0.xsd

<sharding:rule />

NameTypeDescription
idAttributeSpring Bean Id
table-rules (?)TagSharding table rule configuration
auto-table-rules (?)TagAutomatic sharding table rule configuration
binding-table-rules (?)TagBinding table rule configuration
broadcast-table-rules (?)TagBroadcast table rule configuration
default-database-strategy-ref (?)AttributeDefault database strategy name
default-table-strategy-ref (?)AttributeDefault table strategy name
default-key-generate-strategy-ref (?)AttributeDefault key generate strategy name
default-sharding-column (?)AttributeDefault sharding column name

<sharding:table-rule />

NameTypeDescription
logic-tableAttributeLogic table name
actual-data-nodesAttributeDescribe data source names and actual tables, delimiter as point, multiple data nodes separated with comma, support inline expression. Absent means sharding databases only.
actual-data-sourcesAttributeData source names for auto sharding table
database-strategy-refAttributeDatabase strategy name for standard sharding table
table-strategy-refAttributeTable strategy name for standard sharding table
sharding-strategy-refAttributesharding strategy name for auto sharding table
key-generate-strategy-refAttributeKey generate strategy name

<sharding:binding-table-rules />

NameTypeDescription
binding-table-rule (+)TagBinding table rule configuration

<sharding:binding-table-rule />

NameTypeDescription
logic-tablesAttributeBinding table name, multiple tables separated with comma

<sharding:broadcast-table-rules />

NameTypeDescription
broadcast-table-rule (+)TagBroadcast table rule configuration

<sharding:broadcast-table-rule />

NameTypeDescription
tableAttributeBroadcast table name

<sharding:standard-strategy />

NameTypeDescription
idAttributeStandard sharding strategy name
sharding-columnAttributeSharding column name
algorithm-refAttributeSharding algorithm name

<sharding:complex-strategy />

NameTypeDescription
idAttributeComplex sharding strategy name
sharding-columnsAttributeSharding column names, multiple columns separated with comma
algorithm-refAttributeSharding algorithm name

<sharding:hint-strategy />

NameTypeDescription
idAttributeHint sharding strategy name
algorithm-refAttributeSharding algorithm name

<sharding:none-strategy />

NameTypeDescription
idAttributeSharding strategy name

<sharding:key-generate-strategy />

NameTypeDescription
idAttributeKey generate strategy name
columnAttributeKey generate column name
algorithm-refAttributeKey generate algorithm name

<sharding:sharding-algorithm />

NameTypeDescription
idAttributeSharding algorithm name
typeAttributeSharding algorithm type
props (?)TagSharding algorithm properties

<sharding:key-generate-algorithm />

NameTypeDescription
idAttributeKey generate algorithm name
typeAttributeKey generate algorithm type
props (?)TagKey generate algorithm properties

Please refer to Built-in Sharding Algorithm List and Built-in Key Generate Algorithm List for more details about type of algorithm.

Attention #

Inline expression identifier can use ${...} or $->{...}, but ${...} is conflict with spring placeholder of properties, so use $->{...} on spring environment is better.