Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

influx: all old data got deleted after applying retention policy

Tags:

influxdb

I had data from last 7 days in influx. I applied retention policy and suddenly all data got deleted. i have single instance of influx running.

CREATE RETENTION POLICY stats_30_day ON server_stats DURATION 30d REPLICATION 1

ALTER RETENTION POLICY stats_30_day ON server_stats DURATION 30d REPLICATION 1 default

Any idea what went wrong ?

like image 369
Nishant Kumar Avatar asked Jun 03 '16 09:06

Nishant Kumar


People also ask

How does InfluxDB retention policy work?

A retention policy (RP) is the part of InfluxDB data structure that describes for how long InfluxDB keeps data. InfluxDB compares your local server's timestamp to the timestamps on your data and deletes data that are older than the RP's DURATION . A single database can have several RPs and RPs are unique per database.

What is the default retention policy for InfluxDB?

The duration of the default retention policy in Aiven for InfluxDB data points is 720 hours, i.e. 30 days. Any data points older than this (compared to current time) will be automatically removed.

How does influx database store data?

InfluxDB stores data in shard groups. Shard groups are organized by retention policy (RP) and store data with timestamps that fall within a specific time interval called the shard duration. The shard group duration is also configurable per RP. To configure the shard group duration, see Retention Policy Management.


1 Answers

You changed what your default retention policy is. So when you query you'll have to specify the other retention policy. See: https://docs.influxdata.com/influxdb/v0.13/troubleshooting/frequently_encountered_issues/#missing-data-after-creating-a-new-default-retention-policy

like image 79
Paul Dix Avatar answered Sep 27 '22 18:09

Paul Dix