Openhab3 changing to a different persistence

Hi everyone hoping for some tips

I need too swap persist services too something that can handle all types of items and restore them on startup had issues with jjd4j and mapdb (check edits)

EDIT :
I have installed influxdb set it too default in runtime.cfg
Uninstalled all other persistence, created the persist file and set as default persistence in mainui

It looks like influx is now running the mainui charts and restores items on startup i wanted all items stored and restored on startup but it looks like switch items are not restored

I wanted persist all items every minute for charts and every change and restore them all on startup

Strategies {
	everyChange
	default = every1Minutes : "0 0/1 * * * ?"
}
Items {
	* : strategy = everyChange, restoreOnStartup
	* : strategy = every1Minutes, restoreOnStartup
}

If all you care about is restoreOnStartup why not use MapDB? I keep rrd4j for charting and use MapDB for restore on startup and was able to greatly simplify my setup, eliminating three services entirely (InfluxDB, Grafana, Grafana Image Renderer).

Your Items section should probably be

* : strategy = everyChange, every1Minutes, restoreOnStartup

I’m not sure if having restoreOnStartup on to lines will cause OH to try to restore twice which admittedly shouldn’t cause a problem but it’s unnecessary.

I’ve seen some other reports with problems with Switches and Contacts in InfluxDB. I think an issue was filed but don’t use InfluxDB any more so haven’t followed it.

But of you use rrd4j for charting, you will lose some data over time of I’m correct?

As the data ages it gets decimated. Ten concurrent entries are replaced with one value that is the average.

But does it really matter that you have a precise reading every minute from a day two years ago? Most of the time no, it doesn’t. Having one reading every 20 minutes that is the average of those is most of the time more than sufficient. (Note, I’m making that 1 every 20 minutes thing up, I don’t have memorized the decimation schedule).

But Sharpy specifically stated they moved to InfluxDB because rrd4j doesn’t support restoreOnStartup for all Item types, which is true.

1 Like

Hi again @rlkoshak thanks for another reply

Using mapdb and rrd4j was my plan but i had issues

When mapdb was set as default restore on startup worked but rrd4j charts didn’t work

When rrd4j was default mapdb couldn’t restore items but charts worked and i couldn’t find the way too stop this from happening

I have settled with mapdb for restore on startup and influx for charts i may look at getting rrd4j setup again too replace influx

The charts are generated from the default persistence service so you must set it to rrd4j (if using the two). MapDB does not have to be the default to do restoreOnStartup.

However, if setting up MapDB for restoreOnStartup you will want to create an rrd4j.persist file with something like:

* : strategy = everyChange, everyMinute

By default (this is new as of OH 3) rrd4j will try to restoreOnStartup too. Which persistence actually does the restore will be a matter of timing and I can imagine that might lead to unexpected behaviors.

I believe MapDB by default will save every change with restoreOnStartup too but the docs seem to have gone missing so I can’t say for sure. Defining that in the mapdb.persist file might be wise too.

Is it possible to set the persistence strategies through the UI?

No, you must use a .persist file.

1 Like