Storing data into more InfluxDB databases

Does anybody using storing data into more InfluxDB databases? I would like to have more databases with different retention policies.

I have database for all data from HA.
I have database for Glances. Unfortunately, these data has been stored to HA database too, because I didn’t find possibility to remove these sensors from it.
I would like to have database for selected sensors with long time retention.

Thank you for your help and sharing of solutions.

If storing the data into two databases is not a requirement and the main goal is to have different retention periods then you can achieve your goal using Continuous Queries.

I had the same requirement but HA doesn’t support it now. The work around for me was to use node red and in that, the influxdb node can send data to different databases. It works without any issues for me.

Please could you write how to make different retention period in one database?

Both methods 2 and 3 are example of realtime solution. What to do with stored data?

Please could you write me example how to do this?

Its mostly straight forward. You first need to install the influxdb node in nodered.


You must also create different databases in influxdb addon as you like.
After this you need to add these databases to node red influxdb through the server option inside the node. also mention what is measured in the node and all is done.

a simple example would be

[{"id":"8ff94792.f06c08","type":"server-state-changed","z":"5d7b4fc9.0fc78","name":"Energy Total","server":"d177950.2a5aa68","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.energy_total","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":290,"y":2380,"wires":[["f222f87e.d7cac8"]]},{"id":"f222f87e.d7cac8","type":"mqtt out","z":"5d7b4fc9.0fc78","name":"ETL adj","topic":"nodered/energy_total_adj","qos":"","retain":"","broker":"601bef1.d5b981","x":440,"y":2380,"wires":[]},{"id":"d177950.2a5aa68","type":"server","name":"Home Assistant","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"601bef1.d5b981","type":"mqtt-broker","name":"Mosquitto","broker":"192.168.33.250","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]