Persistence suggestion for Raspi and Synology

Hi there,

I’d like to play a bit with persistence and statistical analytics, e.g. which actors were active for how long etc.

My setup is openhab2 beta on a Raspberry Pi2 and I have an additional Synology Diskstation NAS.

What persistence is the easiest to set up such that it will store its data on the NAS? There are some databases that can be easily installed on Synology. Saving files on a mounted shared drive would also do if it is much easier. What would be a natural fit both for setup and analytics. The latter would require some nice means to query data and create statistical views on them.

Any suggestions from experience?

Cheers,
Hauke

1 Like

First of all, if you NFS mount your NAS to /var/lib/openhab all your DB files for the built in persistence will be stored there. So if you do that you will have freedom to use any of the persistence bindings. So the answer to your question comes down to what you want to do with the data. If you want to access the data with external tools you will probably want to stay away from rrd4j and db4o. So that will mean setting up a separate DB server. MySQL has a lot of external tools built for it and it is standard SQL so it is a good choice. InfluxDB has a lot of analysis tools built around it as well and would be a good choice and would probably be the way I would go.

Note that you can have more than one persistence at the same time. For example, I use mapdb in my setup to restoreOnStartup and rrd4j for anything I need to get historic data from or chart. When/if I ever want to study my data I will probably pick Influx. With all of these options, you can pick and choose which items get saved to which DB in the config.

I also have a synology and have setup persistence using mariadb. Synology has a nice package to install it, and you can also setup myphpadmin via a package install too. I combine this with mapping my conf and userdata to my nas for backup as well. In addition, i also use mqtt via my synology and the mosquito package. Makes it all nice and simple and backed up as well.

I’ve only been up and running a week with this setup (and OH2), but no issues and is pretty simple.

Thanks for these hints. Both suggestions sound quite interesting.

  • Influx sounds promising from first sight, especially as it seems to be designed for this exact purpose with no schema required. However, it seems to be quite young with a lack of a great ecosystem of analysis tools. That’s just my first impression from its website. Or can you confirm that there is a large community with good tools?
  • MariaDB on Synology also sounds cool since it seems to be very mature with many third-party tools for analysis. However, for a standard Relational DB you need a DB schema. Does the Openhab Binding (which one?) provide a generic schema or do I have to manually do smth about the schema with new data to be stored?

Well, all I did when I set mine up was create the db and a new user/pass for it via phpmyadmin. Openhab took care of creating the schema and tables etc.

But which persitence type did you configure in openhab? There is no specific MariaDB Binding. So MySQL-Binding? Or JPA-Binding? Or JDBC-Binding?

Sorry. I’m using OH2 and there is a specific jdbc-mariadb binding. However, I think in 1.8 you have to use jdbc. See here

1 Like

I’m also with OH2, so the mariadb binding is cool, thx

@tracstarr: I didn’t find any special MariaDB binding for OH2. However, my installation is about 3 Weeks old… Do you refer to this PR 6 days ago? If it’s just that fresh, I need to update my OH2… :wink:

@rlkoshak: What do you mean by this exactly? I manually copied a OH2 runtime to some /home/openhab/openhab-runtime directory. I do not yet use any real package for that. Thus, my installation uses to store its mapdb to /home/openhab/openhab-runtime/userdata/mapdb.
Is there any special mechanism in OH2 that will check for the existence of /var/lib/openhab and store there stuff if it does? Or does this require some special OH2-raspbian-package or smth like that?

Cheers,
Hauke

I missed that you were referring to oh2. The path i listed is where an oh1 apt-get installed puts it. But my general approach remains. Put a symbolic link to your nas wherever the db gets stored.

Yeah it’s that fresh. I just updated from Friday’s snapshot and found it was now available.