Slaven Tomac
Slaven Tomac

Reputation: 1550

InfluxDB - what's shard group duration

I have created one year policy in InfluxDB and shard group duration was automatically set to 168h.

This is how my retentions look like now:

Retentions

This is how my shards look like now:

Shards

What does it mean for my data that shard's end time is set one week ahead?

Upvotes: 11

Views: 19223

Answers (2)

Sufiyan Ghori
Sufiyan Ghori

Reputation: 18753

In order to understand shard group durations, you need to understand its relation with retention policy duration.

The Retention policy DURATION determines how long InfluxDB keeps the data. While SHARD DURATION clause determines the time range covered by a shard group.

A single shard group covers a specific time interval; InfluxDB determines that time interval by looking at the DURATION of the relevant retention policy (RP). The table below outlines the default relationship between the DURATION of an RP and the time interval of a shard group,

enter image description here

When you create a retention policy, you can modify that shard duration,

CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [DEFAULT]

Upvotes: 7

Michael Desa
Michael Desa

Reputation: 4747

It means that all of data written to database st_test and retention policy a_year with a timestamp between 2016-10-03 and 2016-10-10 will be stored in shard 16.

A retention policy is a container for shards. Each shard in the retention policy will have 1w worth of data. And after 1y that shard will expire and we will remove it.

See the shard documentation for more information.

Upvotes: 11

Related Questions