ShardingPolicy

Updated at:

Parameter

Type

Description

Example

object

The hash write configuration.

shardGroup

object

The ShardGroup configuration. The hash range of the entire Logstore is evenly split into multiple ShardGroups of the same size. The system calculates the first-level hash of the data to be written and writes the data to the corresponding ShardGroup.

keys

array

The keys used to calculate hashes. The keys are case-sensitive and order-sensitive. The keys must be unique.

string

The name of the log field used for grouping.

userId

groupCount

integer

The number of ShardGroups. The value must be a power of 2 and must be less than the number of shards. The value is typically in the range of 4 to 32.

8

shardHash

object

The ShardHash configuration. This configuration is the second-level hash and is used to select a shard within a ShardGroup for writing.

keys

array

The keys used to calculate hashes. The keys are case-sensitive and order-sensitive. The keys must be unique.

string

The name of the log field used for hash routing.

instanceId

maxHashCount

integer

The number of hash retries. If a write fails, the system switches to another hash value to retry the write. Valid values: 1, 2, and 4. The value 1 indicates no retry. The value 2 indicates a maximum of one retry. The value 4 indicates a maximum of three retries.

2

queryActiveTime

integer

The effective period of the query. The value is a UNIX timestamp.

1764659409

enabled

boolean

The enablement status. Default value: true. If you set the value to false, the shardingPolicy feature is disabled.

true