In-memory MariaDB database for Home Assistant.
This is a fork of the official add-on!
This version uses tmpfs to store MariaDB databases in-memory. If you are trying to minimize your SD-card’s wear, give this add-on a try.
Even this is an in-memory database, it can automatically export (from memory to SD card) the database’s content during backup, update, restart or even periodically, and can automatically import (from SD card to memory) the content when the add-on starts again. The database dump is gzip-ed before written to the storage to minimize SD-card wear.
Though it won’t protect you from power failures completely. After a power failure, when the add-on is restarted, it will import the last known exported database content. So when eg. daily periodic export (from memory to SD card) is enabled, you will loose the latest sensory data within that day, but your long term statistics information will remain mostly intact:
Note: If you update or restart the add-on, please stop HA core to avoid error messages
that the database is not available (during plain backup, stopping HA core is not
necessary). You can execute in the command line the
/share/bin/update-mariadb-inmemory-while-ha-core-restarted
or
/share/bin/restart-mariadb-inmemory-while-ha-core-restarted
scripts to do it
automatically.
Or you can execute these commands step by step manually to update the add-on:
- > ha core stop
- > ha addons update 45207088_mariadb --backup
- > ha addons info 45207088_mariadb | grep -E ‘^version’ # wait until the new version is really installed
- > ha addons log 45207088_mariadb # wait until the add-on is started
- > ha core start
Note: The recorder’s commit_interval
parameter is not enough to drastically reduce database and storage (SD card) writes: even if the commit_interval
is very high, eg. 10 minutes, recorder will still commit in each 5 minutes for statistics generation. So with commit_interval
you can’t limit your database and storage (SD card) writes to hourly or daily writes. With this add-on you can limit it to only a few MB-s eg. daily, though with the tradeoff, that you have some chance of short term data loss.
See the Documentation tab for the required configuration changes for the recorder integration!!!
Link & how to install: GitHub - lmagyar/homeassistant-addon-mariadb-inmemory: In-memory fork of the official Home Assistant MariaDB add-on https://github.com/home-assistant/addons/tree/master/mariadb