Removing InfluxDB retention time without flushing old data

I have a retention policy on an InfluxDB database that expires data after 7 days. I have tried deleting the policy, and found that the data (for the past 7 days) is wiped out as well. I'd like to delete the retention policy while keeping the existing data. How can this be done?

Upvotes: 0

Views: 527

Answers (1)

WindyFields
WindyFields

Reputation: 2875

Just copy your data into another RP, say autogen (generated by default, has infinite retention duration):

SELECT *
INTO "autogen"."measurement" 
FROM "7_days"."measurement" 

And than you just drop all the data from 7_days RP:

USE "database"."7_days"

DELETE 
FROM "measurement"

Upvotes: 1

Related Questions