Persistance Service - Which One To Choose

Hello Community

I have OH3.3 running on a PI3, using the 1-wire bus with custom made analog and digital cards I am storing, items are of string-point, string-number.

There is no persistance set up yet, and I am not sure which or what to choose. I noticed when my PI fails because of a power failure, all data is lost, which is not good.

I am not sure which persistence to choose (since there are so many), my requirements are very low (I think).

I do understand that whatever persistance I am about to choose, there are pros and cons, but I could not find a simple listing that helps me decide
which to choose.

Thanks

Note that OH3 generally installs rrd4j by default, this is the source of the “analyze” charts in MainUI.

Note that you may choose more than one. rrd4j is suited for e.g. long term temperature charting (but will not store strings), Mapdb for restore-on-startup, etc. etc, and they can be run alongside each other doing different jobs on different data.
Inluxdb is in common use for non-trivial configurations.

Most likely you are using Openhabian? Which by default configures storage in ZRAM, for performance at the cost of durability. These are options for you to choose, taking into account your needs.

Thanks for your quick and detailed reply.

I saw that rrd4j is installed by default but not acivated, I have not done that since I was not sure about benefits/problems I might be running into.

Since I am ok to store non-string data, need the data even when suffering a power loss, I think I will go ahead and activate rrd4j and take it from there.

Thanks.

Not sure what that means. rrd4j is installed by default, and then goes on to persist everything it can by default. This is presumably the source of the “data” mentioned here

although I’m only guessing what you mean by data.

The persistence chosen has nothing to do with this. openHABian runs OH and a lot of other stuff out of zram to save the SD card from wearing out due to too many writes. rrd4j and InfluxDB installed through openhabian-config will be in this zram.

When you lose power without shutting down, you’ll lose everything in RAM which will be all the data and changes made since the last time the RPi was restated normally.

Keep in mind, if you don’t want to lose data when the RPi loses power, you need and UPS because if the RPi loses power while writing to the SD card, it’ll corrupt the file system. And it’s not just the file being written, it’ll corrupt any file, like the kernel, file system tables, etc. You are in fact playing russian roulette withe every power loss. Eventually you could lose the whole SD card to some sort of catastrophic corruption.

1 Like

Thank you for this interesting input about the possibility of loosing data independent of what persistence being used.

My situation might be a bit different from the usual, my PI runs in a solar-powered house and there is not and won’t be a UPS.
The DC/DC converter to power up the PI should not fail, not often, but sometimes it does…

So I do not know, but as I see it now a possible workaround could be sudo shutdown -r the PI every night.

Thanks!

I’m not sure how an UPS is incompatible with solar power. It’s just a battery with some electronics after all. There are hats for RPis that run off of DC.

Shutting down every night will ensure that you lose nothing more than a day old. But a good backup strategy is also required.