Hi there. I’m using InfluxDB v2.7.1 on Linux.
Up until yesterday morning, I was running on a Centos 8 Stream distro, with InfluxDb installed via rpm/dnf. But then, unrelated to InfluxDb, I borked my OS. Instead of reinstalling Centos, I took the opportunity to switch to AlmaLinux.
Unfortunately, when I reinstalled InfluxDb, I found that everything was wiped out: Historical data, API tokens, logins, and saved dashboards.
I’m hoping with the right filesystem manipulation, it’d be possible to recover at least some of the old state, especially since it’s the same exact InfluxDb code that’s being run.
I lost my root filesystem in the OS reinstall, but I didn’t lose other filesystems.
My attempts to utilize my old /etc/influxdb and /var/lib/influxdb/engine directories didn’t work as expected. Is this because of those two files I lost? Is there another place I should be looking?
The unfortunate reality is that by losing
/var/lib/influxdb/influxd.sqlite , you’ve lost some crucial components for InfluxDB v2.
/var/lib/influxdb/influxd.bolt: This file is the metadata database for InfluxDB v2, and it contains critical configuration data, including user accounts, orgs, buckets, and API tokens.
/var/lib/influxdb/influxd.sqlite: This is for stored queries and tasks, so losing this means any stored tasks or saved Flux queries are gone.
/var/lib/influxdb/engine: This directory actually holds the time series data. So, if you’ve retained this directory, your historical time series data is still there, but without the metadata (buckets, organizations, tokens), accessing it can be challenging.
You can check the following to see if data is still there:
You can try the following:
- Reinitialize InfluxDB: Start by reinitializing InfluxDB (which will recreate the
.sqlite files) and set up a user, organization, and bucket.
- Accessing Historical Data: The real challenge is accessing the old data in
/var/lib/influxdb/engine. The directory structure inside
engine will look something like:
orgID is the unique identifier for the organization.
bucketID is the unique identifier for the bucket.
shardID is the unique identifier for the data shard.The issue is that the
bucketID are stored in the
.bolt file, which you’ve lost. However, you can try to recover by:a. Taking note of the new
bucketID after you’ve reinitialized InfluxDB. b. Shut down InfluxDB. c. Rename the directory structure in
/var/lib/influxdb/engine/data to match the new
bucketID. d. Restart InfluxDB.This may allow InfluxDB to see the old data as belonging to the new bucket.
- Restore Configuration: Unfortunately, for API tokens, logins, dashboards, etc., unless you had an external backup, those are lost due to the missing
.bolt file. You’ll need to recreate them manually.
But I’m not sure if it’ll work because I haven’t tried it.
Thanks so much for this answer. I’m going to make sure my future installs keep the .bolt and .sqlite files on a more permanent filesystem, and back them up to another.