MapDB as secondary persistence


I am currently trying to setup MapDB as a secondary persistence for restore of item states. Until now I had a rrd4j persistence for historic state access (and charts) as well as for restoring of previous states.

As this has some limitations I am trying to use MapDB, but only for restoring the state on startup.

Is it possible to have restoreonstartup rules in mapdb when mapdb is not the default persistence?


restoreOnStartup is not in rules but in the <persistenceservice>.persist file, so yes, it’s easy to use restoreOnStartup with different persistence services - even through different services at the same time.
Of course you should not use the restoreOnStartup parameter from different persistence services for the same item.)

Sure, I defined it in the .persist file, not in the rules.

Seemed that it didn’t work yesterday. I moved my restoreonstartup rules from the rrd4j.persist to the new mapdb.persit file and did 2 restarts with some pause between (as I did not expect things to recover on the first restart because the data has to be written to mapdb first).

I will have to turn debug logs on, just wanted to make sure that it works even when the mapdb persistence is not the default (which all tutorials tell you to enable it ad default).

You definitely don’t need to set any persistence service as default. The only consequence is, you will need to set the used persistence whenever you want to query some state:


instead of


If using rrd4j for charts, you will have to set the option in every line in the seitemap:

Chart item=myChartGroup period=2D service="rrd4j"

instead of

Chart item=myChartGroup period=2D

So default persistence is a nice abbreviation for writing rules and sitemaps.

Please check correct spelling. It’s mapdb.persist, not mabdb.persit (probably a typo only here)
Do you see the file is loaded by openHAB (i.e. some logging in openhab.log)?
Did you install mapdb persistence already?

Thanks for your help. Everything is working fine now. Not sure if this was the root cause, but I created the persist file again. I didn’t have the “strategies” section the first time as I only have out of the box strategies. Not sure if it is required. At least it works now. Thanks