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:
This is how my shards look like now:
What does it mean for my data that shard's end time is set one week ahead?
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.
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.
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.
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.
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.
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,
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With