Sharding

    Class name: org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration

    Attributes:

    Sharding Table Configuration

    Class name: org.apache.shardingsphere.sharding.api.config.ShardingTableRuleConfiguration

    Attributes:

    NameDataTypeDescriptionDefault Value
    logicTableStringName of sharding logic table-
    actualDataNodes (?)StringDescribe data source names and actual tables, delimiter as point.
    Multiple data nodes split by comma, support inline expression
    Broadcast table or databases sharding only
    databaseShardingStrategy (?)ShardingStrategyConfigurationDatabases sharding strategyUse default databases sharding strategy
    tableShardingStrategy (?)ShardingStrategyConfigurationTables sharding strategyUse default tables sharding strategy
    keyGenerateStrategy (?)KeyGeneratorConfigurationKey generator configurationUse default key generator
    auditStrategy (?)ShardingAuditStrategyConfigurationSharding audit strategy configurationUse default auditor

    Class name: org.apache.shardingsphere.sharding.api.config.ShardingAutoTableRuleConfiguration

    Attributes:

    Sharding Strategy Configuration

    Standard Sharding Strategy Configuration

    Attributes:

    NameDataTypeDescription
    shardingColumnStringSharding column name
    shardingAlgorithmNameStringSharding algorithm name

    Complex Sharding Strategy Configuration

    Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration

    Attributes:

    Hint Sharding Strategy Configuration

    Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration

    Attributes:

    NameDataTypeDescription
    shardingAlgorithmNameStringSharding algorithm name

    None Sharding Strategy Configuration

    Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration

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

    Class name: org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration

    Attributes:

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

    Sharding audit Strategy Configuration

    Class name:org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration

    Attributes:

    NameDataTypeDescription
    auditorNamesCollection<String>Sharding audit algorithm name
    allowHintDisableBooleanEnable or disable sharding audit hint
    1. Create an authentic data source mapping relationship, with key as the logical name of the data source and value as the DataSource object.
    2. Create the sharding rule object ShardingRuleConfiguration, and initialize the sharding table objects—ShardingTableRuleConfiguration, the set of bound tables, the set of broadcast tables, and parameters like library sharding strategy and the database sharding strategy, on which the data sharding depends.
    3. Using the ShardingSphereDataSource method of calling the ShardingSphereDataSourceFactory subject to create the ShardingSphereDataSource.