Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 717
Slaven Tomac Avatar asked Oct 05 '16 15:10

Slaven Tomac


People also ask

What is shard group duration InfluxDB?

The shard group duration specifies the time range for each shard group and determines how often to create a new shard group. By default, InfluxDB sets the shard group duration according to the retention period of the bucket: Bucket retention period. Default shard group duration. less than 2 days.

What is shard duration?

Additionally, every shard group has a shard group duration, which dictates the window of time each shard group spans (the time interval). The time interval can be specified when configuring the retention policy. If nothing is specified, the shard group duration defaults to 7 days.

How does InfluxDB store time?

InfluxDB stores all timestamps as nanosecond values, regardless of the write precision supplied. It is important to note that when returning query results, the database silently drops trailing zeros from timestamps which obscures the initial write precision.

Is InfluxDB real time?

InfluxDB. Build real-time applications for analytics, IoT and cloud-native services in less time with less code using InfluxDB. Fast, elastic, serverless real-time monitoring platform, dashboarding engine, analytics service and event and metrics processor.


2 Answers

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.

like image 97
Michael Desa Avatar answered Oct 23 '22 12:10

Michael Desa


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]
like image 6
Sufiyan Ghori Avatar answered Oct 23 '22 12:10

Sufiyan Ghori