Restore deleted data source and point values
-
I just now noticed that I may have accidentally deleted a data source. I have the incremental backups running daily for NoSQL and the H2 backups as well but I am unsure on how to restore everything for a specific source.
Is there some documentation on this that I am missing or could someone offer any help?
Thank you!
-
Yes we have documentation here: https://help.infiniteautomation.com/support/home
You could search there and find this article:
https://help.infiniteautomation.com/support/solutions/articles/14000040833-how-to-restore-a-h2-database-backup -
Would that remove any data sources that were created since the back up?
Will this automatically load the points for the data source from NoSQL?
Thanks Joel!
-
It will overwrite your whole H2 database so any changes that were made after the backup will be lost. If you restore the data before the NoSQL database does it's nightly purge your history data for the points should still be there. If not then you would have to restore the NoSQL database separately. It has it's own tool which can be found on the main menu.
-
This post is deleted! -
Joel,
When trying to restore the NoSQL db it got through 25/45 of the incrementals and it runs in to this error.
INFO 2016-09-23 14:15:35,013 (com.infiniteautomation.nosql.maint.MangoNoSqlRestoreWorkItem.execute:84) - Starting Mango NoSQL Restore WorkItem.
ERROR 2016-09-23 14:49:56,839 (com.infiniteautomation.nosql.maint.MangoNoSqlRestoreWorkItem.execute:101) - Concurrent update java.lang.RuntimeException: Concurrent update at org.tinytsdb.impl.FileLock.lockFile(FileLock.java:197) at org.tinytsdb.impl.FileLock.lock(FileLock.java:79) at org.tinytsdb.impl.Janitor.lock(Janitor.java:66) at org.tinytsdb.impl.TinyTSDBImpl.(TinyTSDBImpl.java:128) at org.tinytsdb.TinyTSDBFactory.createDatabase(TinyTSDBFactory.java:34) at com.infiniteautomation.nosql.maint.MangoNoSqlRestoreWorkItem.restore(MangoNoSqlRestoreWorkItem.java:192) at com.infiniteautomation.nosql.maint.MangoNoSqlRestoreWorkItem.execute(MangoNoSqlRestoreWorkItem.java:97) at com.serotonin.m2m2.rt.maint.BackgroundProcessing$1.run(BackgroundProcessing.java:54) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) -
I have all data sources disabled while doing the restore also.
-
Running each individually seems to be going well so far. I'll report back how it goes.
-
Hi Xof,
I think you're going to be running into some considerations trying to do what you're describing. and you may lose some of your most recent data as you restore the last incremental backups.
It sounds like you've got the data source restored from the H2 backup, and are on to restoring the data. I would extract the incremental NoSQL backups atop one another, starting with the chronologically first using a new directory. Next, I would get the list of Data Point IDs from the database or the SQL commands you used to create them. Inside the mangoTSDB that you have unzipped, you should see many folders 0-99. Inside these directories, you will find more numbered directories. In this second tier of directories, the name of the folder is the Data Point ID.
So, mangoTSDB/49/1/ contains the data files for Data Point ID 1. You can copy the point's folder from the restored database into the active database for each point you need to restore. Be sure to put it in the same top level 0-99 directory!
In a simple restore you will lose the data in the time between your last incremental backup and the current moment, in most cases.
To find a particular folder, you can do something like:
find mangoTSDB/* -type 'd' -name '123'
for a data point with ID '123'
-
Phil,
I restored all of the incrementals up until the deletion occurred since everything since then would be stored on the ES devices we've deployed so I wasn't worried about the most recent stuff.
I did not attempt what you suggested since restoring them one at a time worked. After restoring around 10 I would run in to a concurrent error. I would reboot and then pick up were I left off. Everything seems to have gone well and I don't appear to be missing anything.
Thanks for your help and suggestions.