Influx db - data lost after reboot!?

Hi,

is there a reason why all my stored data is gone when I reboot my Pi? Any idea how to solve that?

Thanks in advance!

Might be similar

well, I discovered that my data from today is still there after a reboot, so a reboot does not damage my data as I suspected.
Today I had a power loss, so this probably is the reason for the loss of data, but the data must be anywhere or is it possible tht the whole database got erased??

Is your influxdb copied into zram during system boottime ?
In case you have a power failure there is not time to write back changes of your influxdb back to sd card.

I don´t know if it is copied to zram and have no idea how to find out, but since all my data from the past months is gone I don´t think it is a RAM problem…

Let’s start with basics, then. I guess you use openHAB, but what version? Do you use openhabian? Then you use zram. What version openhabian?

I´m using openHAB 3.1.0 and have configured InfluxDB Database version to 1. InfluxDB shell is at ver 1.8.10

Let’s assume your influxdb is running on the same box as openHAB, or you probably would have said if not.

By searching your old posts, you talk about using openhabian, so I am going to have to guess that you use openhabian here. If you don’t know anything about zram, you have almost certainly got that active as well by default.

So the effect you described in post #1 is exactly what we’d expect to see when using a database in zram. Power fail - poof, all live data disappears.
It will usually auto-recover back to the last time you did a tidy planned shutdown, could be weeks ago.

Zram is there to improve performance. As a side effect, it reduces “wear” and extends the life of SD cards. Especially helpful if you have let persistence settings default to “everything”.

So now you have choices.
One choice is to turn zram off.
Another is to exclude from zram just the influx service.
Another is to find out how to take regular checkpoints of the service, so that if there is a failure you only lose, say, a day’s data.

In all cases, if you are not already selecting what/when you have influxdb persist, it would probably bea good idea to review it.
Any any other databases you have, like the default rrd4j.

Thanks for the detailed info and yes, I´m using openhabian. So how can I exclude influx from zram?

Have a look part way through this thread, to check (so far this is all only speculation)

You won’t want to do that as InfluxDB will trash your SD.
When you reboot, current persistence data will also be copied to SD and available from there on. Rebooting is not recommended, however (let alone for just this purpose) .
So the official recommendation is to setup the data safety features of openHABian (menu 50) so you have a daily backup to restore from if in need e.g. after a power loss.

PS mind the posting rules, please. Search the forum and comprehensively describe your setup in the first place i.e. before you ask.
How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

In grafana I can see all records since 07.02.22, a day before I had a power loss. Now all data before 07.02.22 is gone, all the past months, how is this possible? Was all the data only in RAM? The device has also been rebooted a couple of times in the past months…
InfluxDB is indeed running on the same Pi as openhab is running on.

See

In the case of a power failure, that doesn’t happen. So in-memory data since your last controlled reboot is lost. Power failure may also trash files on SD card, so - zram or not - you risk losing everything if you don’t take backups.

As I mentioned, the device was manually rebooted several times in the past, so that´s why I don´t understand why all the data has gone!

Anyway, I will monitor this and also try to setup an Amanda Backup…

Thanks!

which is where the last copy made at controlled reboot would live.

I’ve no idea if that happened to you, it’s a random effect, but there’s no reason that it shouldn’t.
If you have no other copies, you are goosed.

We can’t help you as though we asked you still didn’t tell us the relevant details such as e.g. the openHABian version and branch that it takes at least to understand complex issues like this.
Eventually you have some old version. It’s always worth a try to reinstall to at least be on latest software.