How can i install a alternative Persistance/Database as rrd4j

Hi there,

im completly new to the openhab topic. I have installed Openhab 3 on a Raspberry 4.
I have defined my home model and integrated some shelly plugs. Runs really fine. I can view the measurements and switch on/off. The RRD4j persistance works also fine after i have disabled and enabled zram! But RRD4j has a major problem. It doesnt save the data when you cut off the power from the raspberry. In fact i have lost several days of measurements. Thats very bad!!!

Now i want to use a database for storing all the measurements which is a big problem for me. How can i install a database for persistance? Every database which is shown over the addons menu isnt working if i install them over the openhab 3 addons menu.

Is there a working howto or did i forget some steps?
Btw: Grafana is installed and works fine. But now i need a datasource.

greetings

1 Like

How do you cut off the power?
Just pulling the plug ?
That would not be the right way. You would have to shutdown the Pi/OS first. Then pull the plug. This also should make sure that data is written to the SD card because zram will be shutdown as well.

In addition to @Wolfgang_S , the observed problem would be the same when changing to another database because it is solely caused by the wrong handling of the system running openhabian without an UPS.

yes exactly. Sometimes it could happen that we have no energy. So in my thinking with a database the openhab writes all the data to the database and with a new start of the system the last values of the DB are loaded…

But i think RRD4J works not in this way. I can see that every minute the logging files are updated. So normally all the values stored every minute to the sd card. But if you power off the system the values lost until the last reboot of the system

rrd4j works fine (except the very last minute will be lost)
Your problem is ZRAM.
If you want to install some other persistenceservice, openHAB offers several choices, go ahead.

In the event of sudden power loss there is also risk of randomly corrupting any system file or data.
If this is an important system to you, you will need to manage tat risk as well (usually by UPS)

okay then i have a failure with zram …
i think that that all the values stored at zram and when your reboot the pi the data is written to sdcard. I can see that every minute are data is written to the directory.

But in case of power loss there is a data lost from now to the last reboot of the system.

“the directoiry” is held in RAM.

Yes. ZRAM flushes its memory cache to SD card only on a tidy closedown.

is it possible to use rrd4j with grafana?

All the other databases are possible to install but nothing of them is working!
Installation works … sure … but openhab didnt store any measurement … i get jdbc errors … username errors … java errors …
this part is not the easyiest one …

N0, it isn’t.
You will not get much help if you do not give real details e.g. an actual error message and which db you are trying at the time. It works for other people.

But if what you really want to do is tackle your data loss, you’re just wasting your time playing with other databases - it will not help unless you install the database on some external machine that is not suffering power loss.

Many users face the same data loss problem, and there are a number of things that they do about it.

From “do nothing” - tolerate the problem. That depends how important it is to you, does it matter if you are just making pretty charts?

Through “minimize the problem”- arrange to save data to SD card periodically, at the period of your choice. Daily perhaps.

Or “prevent” the problem. Turning off ZRAM is cheap. Using a UPS wil cost you. All your choices.

okay then lets make it more detailed.
I have installed now the influxdb/grafana package over putty and “sudo openhabian-config” … so thats the whole package with influxdb/grafana and database/usernames creation.

What are the next steps!?

Now i get:

if i switch to InfluxDB2 then i get:

this is the worst installation process i´ve ever seen!

grafik
nothin is accepted. Everytime i get unable to parse auth. credentials

  • Install the add-on under Settings → Other Add-ons.

  • Configure InfluxDB using the instructions in the docs: InfluxDB (0.9 and newer) - Persistence Services | openHAB. Your username looks like it will be openhabian and password what ever your password is to log into your machine via ssh.

Except for MapDB and rrd4j, all the other databases are separate programs as big and complex and capable as openHAB itself. By switching to one of these other databases you are increasing the complexity of your system and it is going to take more to get it set up and working.

now it works without errors!

it was an previous instance of influxdb installed with other user/password credentials.
With these “old” username and password was the login possible and now it logs the data to the db.

and now …lets play with grafana :slight_smile:

if i reboot the pi … the old username/passwort are loaded automatically. How can i correct this?
Now i have to change it manually over openhab/settings/InfluxDB Persistence Service after every reboot.

found solution:
login credentials are in: /etc/openhab/services/influxdb.cfg

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.