IMD SolutionComputing LibraryShop main store

Troubleshooting

Why InfluxDB 1.x data is invisible in the 2.x Data Explorer

Edge computing and IIoT Published 6 min read

Short answer

The old points are almost certainly already in 2.x: the influx v1 shell reads them through InfluxQL and a DBRP mapping, while the Data Explorer runs Flux against only the bucket and time range its query names. Point the Explorer at the migrated bucket with an absolute range covering the old timestamps, and create a DBRP mapping only for clients that must keep speaking InfluxQL.

On this page
  1. Why the shell and the Explorer disagree
  2. Check the two paths in this order
  3. Worked example: turning the 1615981010728 record into a Flux range
  4. Fix the DBRP mapping only for InfluxQL clients
  5. One clean schema instead of two views
  6. Decision by symptom
  7. Questions asked

Your old points are almost certainly still in the database. In InfluxDB 2.4 the influx v1 shell speaks InfluxQL and resolves your 1.x database name to a bucket through a DBRP mapping, while the Data Explorer runs Flux against only the bucket and time range its own query names. That is why the shell lists the 1.6-era series and the Explorer does not: two languages, two paths, one store. Nothing needs remigrating. Prove the data is there with one bounded Flux query, point the Explorer at the right bucket and range, and add a DBRP mapping only for the clients that must keep speaking InfluxQL.

Why the shell and the Explorer disagree #

influx v1 shell sends InfluxQL. A statement like select * from "mqtt.0.esp01.sensor.temperature.state" names a database, and 2.4 resolves the database and retention-policy pair to a bucket through a DBRP mapping before the query runs. Your shell result proves three things at once: the points were ingested, a mapping for that database name exists, and the bucket behind it holds your history.

The Data Explorer runs Flux. A Flux query names one bucket in its from() call and one window in its range(), and the Explorer's range picker supplies relative presets over recent time unless you switch to a custom absolute range. The Explorer is not a browser over every database a v1 client can name, and its presets cannot reach a 2021 timestamp. An empty Explorer beside a full shell is the expected picture, not evidence of loss.

Check the two paths in this order #

  1. In the shell, run the query that already works and copy one returned timestamp and the exact measurement spelling. The dotted name must stay double-quoted in InfluxQL; unquoted, the parser reads the dots as separators.
  2. List the buckets in your organization and identify the one the migration wrote the 1.x points into.
  3. In the Explorer, select that bucket as the query source, switch the range picker to a custom absolute window covering the timestamp from step 1, and filter on the same measurement and field.
  4. Read the outcome: rows returned means the data is present and the fault was the Explorer's bucket or range; zero rows sends you back to the organization, the bucket name and the quoted measurement before anything else.
  5. If the bucket comes back empty after a container restart, the migrated files are not on the volume the container mounts, the storage fault traced in why an InfluxDB container loses old data after restart.
  6. Fix the DBRP mapping last, and only for InfluxQL clients that must read a 2.x bucket.

Worked example: turning the 1615981010728 record into a Flux range #

The inputs, each from your own migrated record:

  • Record timestamp: 1615981010728, in epoch milliseconds, as the 1.x side stored it.
  • Measurement: mqtt.0.esp01.sensor.temperature.state, exactly as the shell returns it.
  • Stored value: 16.5, in the source adapter's own unit, carried through unchanged.
  • Constants: 1000 ms per second, 86400 s per day, and the UTC calendar.

The rule in words: the Explorer filters on RFC3339 start and stop instants, so the epoch-millisecond time must be placed on the calendar first. Divide by 1000 for seconds, split off whole days, convert the remainder to a clock time, then count the days forward from 1970-01-01.

The arithmetic:

  • 1615981010728 ms / 1000 = 1615981010.728 s
  • 1615981010.728 s / 86400 s per day = 18703 whole days plus 41810.728 s (18703 x 86400 = 1615939200; 1615981010.728 - 1615939200 = 41810.728)
  • 41810.728 s = 11 h 36 min 50.728 s (11 x 3600 = 39600; 41810.728 - 39600 = 2210.728 s, which is 36 min 50.728 s)
  • Day count: 18628 days reach 2021-01-01 (51 x 365 + 13 leap days); 18703 - 18628 = 75 days into 2021; 31 + 28 = 59 reaches 2021-03-01; 75 - 59 = 16 more days lands on 2021-03-17.

The record therefore sits at 2021-03-17T11:36:50.728Z. Bracket it with a one-day range and query the bucket:

from(bucket: "migrated-1x")
  |> range(start: 2021-03-17T00:00:00Z, stop: 2021-03-18T00:00:00Z)
  |> filter(fn: (r) => r._measurement == "mqtt.0.esp01.sensor.temperature.state")
  |> filter(fn: (r) => r._field == "value")

migrated-1x is an example bucket name; substitute the bucket from step 2 of the checklist. from, range and filter are documented Flux functions, and the strings inside them are your data. The test that proves the result: the query returns one row with _time 2021-03-17T11:36:50.728Z and _value 16.5. One returned row ends the investigation: the migration is good, so keep this bucket selected and use absolute ranges for history views. Zero rows moves you back to the bucket name, the organization and the container's volume; do not touch DBRP mappings for an Explorer problem.

Fix the DBRP mapping only for InfluxQL clients #

When a v1 shell session, an InfluxQL data source or a legacy application must read a 2.x bucket, its request arrives as a database name plus an optional retention policy, and 2.4 serves it through a DBRP mapping. Two 2.4 specifics matter. Creating a bucket whose name follows the database/retention-policy naming convention auto-creates a mapping, and a 2.4 defect report describes the v1 shell failing against exactly those automatic mappings, so an existing mapping is not proof the shell will work. List the current mappings, then create an explicit one with influx v1 dbrp create, which binds a database name, a retention-policy name and a bucket in your organization; confirm the flags from the command's help on your installed build. Retry the original SELECT through the same endpoint and credentials.

Grafana's InfluxQL data source depends on the same mapping, set up step by step in configuring an InfluxDB DBRP mapping for Grafana InfluxQL. A mapping moves nothing: it is a name-to-bucket binding, not a copy. If nothing on your plant floor speaks InfluxQL anymore, skip this section entirely.

One clean schema instead of two views #

Living with two views works, but if the 1.x schema was misnamed or mistagged, the deliberate move is an application-level transfer: read the old records with an InfluxQL SELECT through the 1.x side, then write each record into a new destination bucket, renaming measurements, tags and fields on purpose as you go. A destination bucket separate from the source is a requirement of the published step-by-step migrations, because writing back into the source overwrites the very history being copied. Node-RED or a short script both drive the loop: migrate one measurement end to end, verify a known timestamp and value in the destination, then loop the rest. The full sequence is in how to migrate InfluxDB 1.x data into 2.x buckets. Keep the jobs separate: the read path and the mapping path must each work alone before any schema conversion begins.

Decision by symptom #

Symptom Meaning Action
Shell returns 1.x points, Explorer empty Two query paths over one store Select the migrated bucket and an absolute range in the Explorer
Explorer returns the point once the range covers it Data present; mapping optional Keep Flux for history; create a DBRP mapping only for InfluxQL clients
Shell and Explorer both empty Ingestion or storage at fault Check the bucket contents and the container volume, then remigrate
Shell fails on a 2.x bucket that Flux reads Mapping missing, or an automatic one Create an explicit mapping with influx v1 dbrp create

In every row the bounded Flux query is the arbiter: it separates an Explorer setting from real data loss before you change anything.

Questions asked

Can I paste my InfluxQL SELECT into the 2.4 Data Explorer?

No. The 2.4 Explorer runs Flux only, so an InfluxQL SELECT pasted into it fails even when the data is present. InfluxQL reaches a 2.x server through its v1 compatibility API, which the v1 shell and InfluxQL data sources call. That is why a full shell and an empty Explorer are not a contradiction: they are two languages on two paths.

Can one chart show the old and the new points together?

Yes, when both buckets share the measurement, field and tag schema. Run one from() call per bucket, combine the two tables with union(), then apply the range and filters once. If the migration renamed fields, align the names before the union or the series will not stack. Save the finished query as a dashboard cell.

Does an application-level migration need a separate destination bucket?

Yes. The published step-by-step 1.x-to-2.x migrations make a new destination bucket a requirement, because writing back into the source bucket overwrites the very history being copied. Create the destination in the same organization and give it a retention rule that keeps the full span you are moving, including the oldest 1.x records.

Where do I find the oldest migrated timestamp for an absolute range?

Ask the shell. Run the working InfluxQL SELECT without a time clause, read the earliest time it returns, and use that instant as the start of an absolute Explorer range. An InfluxQL query with no time clause returns the full history, so the first row of the result is your boundary.

Keep reading

  • Troubleshooting

    Troubleshoot missing data in a Node-RED InfluxDB Grafana stack

    Work the chain in order: acquisition into Node-RED, the InfluxDB service and its storage mount, the write settings, then the Grafana query. In a 2.x stack most empty panels trace to a wrong token, bucket, URL or a controller clock that stamps points outside the panel's time range.

    Edge computing and IIoT

  • Troubleshooting

    OpenEMS InfluxDB password versus API token in Docker

    The password in the documented influx setup command initializes InfluxDB's first user account; it is not what OpenEMS sends. On a v2 server such as the reported v2.7.12 container, OpenEMS authorizes with an API token in the Timedata.InfluxDB ApiKey field, so you choose your own secret password at setup and enter the token, not the password, in the connector.

    Edge computing and IIoT

  • Explainer

    Why the v2 Java client cannot create a database on InfluxDB 1.8

    InfluxDB OSS 1.8.5 implements only the v2-compatible write and query endpoints, so the v2 Java client's createV1 plus getBucketsApi().createBucket returns 404 and creates nothing. Create the database with a POST of CREATE DATABASE to the 1.x /query endpoint, admin credentials when authentication is on, and keep the v2 client for writes and reads.

    Edge computing and IIoT