High, I’m trying to get RestoreOnStartUp using MapDB to work.
I’m using OpenHAB2, MapDB is installed as well as RRRD4J. RRD4J is working as expected.
In MapDB.persist I have:
Check your userdata/persistence folder. You should see a mapdb folder in there. There should be at least one mapdb file in there and it should have a non-zero size.
Verify all of these are the case. If not it means your MapDB is not saving any data. If the mapdb folder doesn’t exist you may need to create it. This is something I ran into when setting it up and I’ve submitted an issue over it.
I do have a mapdb-folders folders under /var/lib/openhab2 and /var/lib/openhab2/persistence . Both with 3 non zero files. Which folder is really needed and which file should get updates?
[Edit]
I’m feeling sorry, because it’s always you who is answering my questions.
They are both needed. The “main” mapdb folder is for the item/things internal
DB of OH. The subfolder in openhab2/persistence is the right one to watch.
In both folder is a file named “storag-apdb.t”. Both have a date of yesterday, probably the time when OH was started last.
So MapDB migth be storing the states, but I think they don’t get restored. How would I get Debug mesages for the restoring?
The files in /userdata/mapdb should have a timestamp from when the last config through PaperUI (or Habmin) has been changed.
The files in /userdata/persistence/mapdb should have a timestamp from the last item change (push a switch or whatever).
Edit: I don’t use apt-get at the moment, so your folder locations may be different …
Yes, the name is “storage.mapdb*”
I do see only the file “storag-apdb.t” getting an update in the date/time whenever restarting OpenHAB. That is true for the files in “openhab2/persistence/mapdb” as well as in “openhab2/mapdb”.
The size of all 3 files in each of the folders do not change.
After digging deeper, I realized number items are getting restored, however the string items (which I was looking at) are not. In my understanding mapdb would store strings as well.
Maybe OH is mixing up the two installed persistence services? You wrote that you are also using RRD4J and RRD4J ONLY stores number items. Is this a coincidence that number items get restored?
I would give it a try and completely disable rrd4j and only use mapdb. Define mapdb as standard in PaperUI, make a reboot (just to be sure…) and then “play” a little bit with the system to get some value/item changes. Then take a look if the mapdb files will change.
Furthermore please take a look at the example for the restoreonstartup persistence
configuration (scroll completely down to the bottom of the link):
I do not see any difference besides the missing declaration of a default strategy. I’m not using it, so it isn’t needed.
Tried to remove rrd4j persistence using PaperUI, didn’t work:angry:
What log:set command is need to get such log-entries:
2016-08-09 21:26:11.958 [DEBUG] [.p.m.i.MapDBPersistenceService] - store called for mapdbTest
2016-08-09 21:26:11.961 [DEBUG] [.p.m.i.MapDBPersistenceService] - Stored ‘mapdbTest’ with state ‘ON’ in mapdb database
2nd Edit: I just tried the above command and yes, it’s working as expected.
To set it back to info level you need: log:set info org.openhab.persistence.mapdb
Thanks for that input.
First I had no entries, then I did insert a default strategy (is suggested by @jaydee73). I was WRONG, after changing the .persist file I got log-entries immidiatly!!
Now I do see entries for my string item being logged, but after a restart this string item remains NULL??
[Edit] Never mind, after a second restart, the stroed string value is used!