Troubleshooting
Why InfluxDB data looks erased after a controller reboot
Short answer
Nothing is deleted: the default InfluxDB retention policy keeps every accepted point indefinitely, so an empty result after a clean restart means your query's time window no longer covers the stored timestamps. Read the controller clock first, query an explicit range that covers the write session, then prove persistence with one test measurement through a controlled reboot before touching retention.
On this page
- Why does InfluxDB look empty after the controller restarts?
- How does the controller clock make stored data invisible?
- Which time range brings the hidden points back?
- Where does the timestamp on each point come from?
- How do I prove persistence with one test measurement?
- When does retention actually delete InfluxDB data?
- Which failure do I have, and what is the decision?
- Questions asked
The restart did not erase your database. InfluxDB on an edge controller writes every accepted point to disk and keeps it with no expiry under the default policy, so an empty query result after a clean shutdown means the query no longer looks in the right place in time. In practice that is almost always a controller clock that jumped at power-up, or a relative query window that moved with it. Check the clock, widen the query range to the write session, then prove persistence with one test measurement through write, read-back and a controlled reboot. Only a finite retention duration deletes points on a schedule, so leave the retention settings alone until the other checks are done.
Why does InfluxDB look empty after the controller restarts? #
By default nothing is deleted: InfluxDB stores every accepted point on disk with no expiry, so a query that returns nothing after a clean restart means your query's time window no longer covers the timestamps that were written.
InfluxDB is a time-series database: every point carries a timestamp, and a filtered query selects points by that timestamp, not by the moment you open the dashboard. Exactly two mechanisms can hide points from a query result, and only one of them removes them from disk:
- A time filter: the query's start and end bounds exclude the stored timestamps. The points remain on disk, and any wider query over their range returns them.
- A finite retention duration: a policy with a set
DURATIONdeletes expired points on a schedule.
A clean shutdown triggers neither. If the controller keeps the database on a separate or removable volume, check one more thing: that the volume was mounted before the database service started. A runtime pointed at a path with no volume behind it reads an empty store and shows the same blank result.
How does the controller clock make stored data invisible? #
A clock that resets at power loss stamps the whole post-reboot write session with the wrong date, so a query for recent days misses every point; the data sits outside the window, stored and intact, until you widen the range to cover it.
An edge controller that starts without a battery-backed real-time clock, or without a working time source at startup, can come up at a stale default date and write true process data under a false timestamp. Work the clock check before writing anything new:
- Read the controller clock immediately after startup and compare it with a trusted reference; check the date, not only the hour.
- Record the controller's time zone setting and the time zone your query tool applies to what it displays.
- Read one stored point's timestamp, if any query still returns one, and note whether the write path supplied it or the database did.
- If the clock is wrong, correct it and fix what keeps it correct across a restart.
- If the clock reads true, move on to the query-range check.
Fix the clock at its source: a synchronized network time source at startup, not a one-off manual correction, or the fault returns at the next power cycle. If your Node-RED runs in a container, it adds no clock of its own — a containerized flow stamps points with the host clock, as explained in Node-RED in Docker uses the host clock, not its own time — so correct the controller clock rather than the container.
Which time range brings the hidden points back? #
Query an explicit range that starts before the wrong-clock session rather than a relative window: set the start at the day the controller last ran correctly and the end at now, and the missing points reappear if they were only hidden by the time filter.
Worked example, with illustrative numbers, all times UTC: at 09:00 on 12 March 2025 you query the last 24 hours, so the window runs from 2025-03-11 09:00 to 2025-03-12 09:00. At the reboot the controller clock came back set to 2024-11-05 00:00, and the whole post-reboot write session was stamped inside that day. From 5 November 2024 to 12 March 2025 is 30 + 31 + 31 + 28 + 7 = 127 days, so the newest hidden point is stamped 127 days before the query date and the window never touches it. Re-run the same query with an explicit start of 2024-11-01 00:00 and the session reappears untouched.
Relative windows are the trap: last 24 hours moves with the viewer's clock, so it misses the wrong-dated points on every refresh and makes persistence look broken forever. Keep the database and measurement fixed, change only the bounds, and read the returned timestamps rather than the shape of the trend. If the points appear only around the recorded wrong date, the timestamp source in the write path is your next stop.
Where does the timestamp on each point come from? #
Each point carries the timestamp the writer supplied or the database time at the moment of the write when the writer supplies none; inspect the write node's configuration and message before assuming the database invented a wrong time.
The InfluxDB write node for Node-RED takes an optional timestamp from the message and, when the message carries none, stamps the point at the write's current time. To see what your flow actually sends, put a debug node ahead of the write node and read the timestamp property — the same read-the-debug-log approach used in troubleshooting InfluxDB MQTT timestamps and debug logs.
A message reaching the write node proves nothing by itself: check the write result and any error output before you count the point as stored. If the flow computes timestamps on its own, verify those values against the controller clock, because the write node does not correct them. Record three things for the trace that follows: the database and measurement the write path targets, the timestamp source the flow uses, and whether the write reported success. If a read-back already fails before any reboot, the fault is in the write path, not persistence — work through the checks that fix Node-RED InfluxDB write errors after a network outage first.
How do I prove persistence with one test measurement? #
One identifiable test point settles it: write it, read it back immediately, note its stored timestamp and the exact query bounds, restart the controller cleanly, then run the same fixed-bounds query — if the point returns, persistence is proven and the fault was the window.
Reboot a controller that supervises a running process only from a safe state and with operations aware of the stop, or defer the test to the next planned shutdown.
- Correct the clock and its startup synchronization, so the test writes true timestamps.
- Write one unmistakable test point into the target database — for example a measurement named
reboot_testwith a field value of 1 and a tag naming the test run. - Read it back immediately and record the stored timestamp, the destination and the exact bounds that returned it.
- Shut the controller down cleanly and start it again, then wait until the database is running and accepting queries, not just until the interface is up.
- Read the controller clock again, and re-run the query with the same fixed bounds.
- Compare: the point returning with the same stored timestamp proves persistence; the point missing while the clock stayed true moves the fault to the storage location or the retention settings.
When does retention actually delete InfluxDB data? #
Only a finite retention duration deletes on a schedule: the default policy InfluxDB creates, named autogen, has infinite retention, so points vanish on a timer only after someone sets a DURATION — for example 30 days — on the policy that owns the measurement.
A time filter hides points from a query; a retention policy removes them from storage. That distinction decides the fix, because widening a window recovers visibility in the first case and cannot restore anything in the second. Enforcement also runs on shard groups rather than single points: with an unmodified default policy the shard group duration is 7 days, so a finite DURATION still keeps a point until its whole shard group has expired and the effective cutoff moves in week-long steps.
The symptom signature is only the older points are gone, at a roughly fixed age: read the DURATION set on the policy your measurement writes into and set it to the history length your process actually needs. If old points vanish on every restart while retention is infinite, that is a different fault — a data directory being recreated rather than expired, the storage-volume behavior behind why an InfluxDB container loses old data after restart. Do not disable retention to make a blank screen go away: first establish whether the points sit outside the query range or outside the policy interval, because those are different failures with different fixes.
Which failure do I have, and what is the decision? #
Decide by what a widened fixed-bounds query returns: points inside the widened window mean a clock or time-range fault and you fix synchronization only; no points anywhere mean the write path, the storage location or a finite retention duration, in that order of likelihood.
| What the widened fixed-bounds query shows | What it means | Decision |
|---|---|---|
| Points appear, stamped with the recorded session date | The clock moved and the original window excluded them | Fix clock synchronization; query the recorded range |
| Points appear only under an unexpected date | The write path stamped that date | Keep those stamps; trace the flow's timestamp source |
| A direct query finds the points, the dashboard does not | The display query or its filters exclude them | Correct the dashboard's range and filters |
| Nothing anywhere although the write reported success | The storage volume or data path came up empty | Verify the database volume is mounted and holds the data |
| Only points older than a fixed age are gone | A finite retention duration expired them | Set the DURATION to the history the process needs |
The decision for the reboot case: a clean restart does not delete accepted points under the default policy, so treat a blank result as a visibility fault until a fixed-bounds query over the recorded timestamp proves otherwise. Reinstalling the database app, recreating the database or loosening retention before that test is what actually puts recoverable history at risk.
Questions asked
Does correcting the clock move the timestamps already stored?
No. A clock correction changes only the timestamps of points written afterwards. Points recorded during the wrong-clock session keep their recorded date, so you reach them by querying the range they were written into rather than the range they should have had. Moving those points to correct times would mean re-writing the session from a buffered or upstream source.
How precise are the timestamps the Node-RED InfluxDB write node stores, and what if my units are wrong?
The write node records its default timestamps with millisecond precision. If you pass a timestamp in the message, supply epoch milliseconds: an epoch expressed in seconds reads as a date in early 1970 once stored, and such points then sit far outside any modern query window and look lost.
Can a power cut lose points even when retention is infinite?
Retention governs deletion by age, not by power events, and a clean shutdown or restart does not remove accepted points. An uncontrolled power cut can put the last writes that were not yet confirmed to storage at risk. That is why the controlled reboot with a confirmed read-back matters more than the retention setting when points vanish.
Why does the dashboard show a different hour than the stored timestamp?
InfluxDB keeps timestamps on UTC and the display converts them to the viewer's local time zone. A point stored at 13:00 UTC appears as 14:00 on a viewer set one hour ahead of UTC. Compare the raw stored timestamp, not the plotted one, when you match a point against your query bounds.