motleyagency / influxdb-incremental-restore

InfluxDB incremental restore script
MIT License
14 stars 0 forks source link

Retention policies not getting restored #14

Open colinl opened 4 years ago

colinl commented 4 years ago

I tried this, with Influx 1.8.0, and it is perfect (and very much needed) except that everything is restored to the autogen retention policy instead of the ones actually in use. Using influxd restore does restore ok (but not the whole set of backups of course. Is this a known issue or am I doing something wrong? If I explicitly specify a retention policy (-rp) then the policy is created but there is no data there. I am using nodejs 12.18.0 on Ubuntu 19.10. I very much hope there is a solution to this as it would save me a lot of hassle.

petetnt commented 4 years ago

Hi @colinl!

The retention policy you are describing sounds new to me. Can you post the commands that you are running (including the ones ran with influxdb restore?

According to the code the -rp flag should be correctly passed to the config/influxdb restore command, but not sure if that actually happens 🤔

https://github.com/motleyagency/influxdb-incremental-restore/blob/master/src/index.js#L358

colinl commented 4 years ago

Hi, thanks for looking at this. Just to clarify, I don't want to use -rp, that was just a test to see if it worked if I explicitly defined it. To simplify the problem I have tried it on just a single incremental backup. The command I used to make the backup was influxd backup -portable -database Tydwr -start 2020-06-10T21:12:08Z -end 2050-01-01T00:00:00Z -host <server>:8088 ~/temp/influxdb_backup To restore it I use influxdb-incremental-restore -db Tydwr -newdb Tydwr_part ~/temp/influxdb_backup_part/ and I find the data is there but it is all in autogen if I use influxd restore -portable -db Tydwr -newdb Tydwr_part_a ~/temp/influxdb_backup_part then it does work. The retention policy containing the data is named one_year This is a small backup with only test data so I have attached the backup in case it is useful for testing

influxdb_backup_part.zip

petetnt commented 4 years ago

Thanks for the test case and explanation! I'll try to look into this tomorrow

colinl commented 4 years ago

I wondered whether it might be a nodejs version 12.x issue, but I have tried downgrading to 8.17.0 and get the same result.

petetnt commented 4 years ago

Sorry, took a bit of detour here while converting this lib to TypeScript first, gonna check this out asap as that works