Persistence recommendations

Given the range of persistence options, this is an elicitation of recommendations for one of the options with the following criteria;

  • very ‘lightweight’ resource consumption (am planning to migrate to RPi)
  • very simple installation and upkeep
  • maintain data in order to provide;
    – trend data (over days, months, even years)
    – restore values after reboot
    – maintain ongoing state on some items
  • cost (free is preferred but not absolutely required)
  • supports charting of aforementioned trend data (also understanding Influx/Grafana has nice charts that can be displayed)

P.S. Are there other important common criteria that experienced OH’ers would like to mention?

Some thoughts: you may not get all your requirements met by one service (especially lightweight and all the functionality you want); keep in my mind that persistence may do a lot of writing, so if you run your RPI with an SD-card, this will wear out your card faster, you may need a NAS, SSD, or HD connected to your RPI.

  • one of the most popular solution seems to be grafana and influxDB (there are tutorials: InfluxDB+Grafana persistence and graphing), however, this combo may be a little heavy on a RPI, but it is possible and there is a lot of help available in the forum; OpenHabian comes preconfigured with influxDB, I believe, otherwise there is more work to install the database
  • personally, as I have only very modest graphing needs, I am using mapdb for restoring values on startup (mapdb stores all item values irrespective of the type, but only one value per item, so is not suitable for graphing or anything else really; but come with OH2, just activate persistence, write a strategy and you are done. For all others I am using rrd4j; I like the idea of a fixed database size; but rrd4j does only store numerical values; also here no need to install a separate database
  • MySQL and MariaDB is also frequently used, just search the forum; but again considered too heavy for the RPI (at least if you persist a lot and for a long time)
  • Don’t feel like you have to choose just one. I run with MapDB for restoreOnStartup and InfluxDB for historical data and charting. A lot of people use rrd4j for historic data which has the advantage that it is an embedded database (i.e. nothing separate to install) and it never grows in size, but has the limitations that it can only store numeric data and as the data gets older it gets decimated (i.e. ten consecutive values are replaced with one value which is the average of those ten). For most purposes, this is fine but in some cases this loss of precision is unacceptable.

  • I’ll second Lipp’s warning. It doesn’t matter what you choose, if you are running it on an SD card the SD card will wear out.

See Design Pattern: Group Based Persistence


For anyone following this thread who has a similar question, I strongly encourage you to see the above design pattern, which will save 10s of hours of guesswork and fiddling.