Not able to restore from Influxdb v2.4 to v2.7

Hello,

I’m running influxdb v2.4 on my first Raspbian 64bits, I would like to restore the full data (2 years data history) on my influxdb v2.7 installed on my New Raspberry.

I have already accomplished backup and restore without any issue but still using v2.4 influx release (backup and restore).

I do not know what I’m doing wrong or what I need to fix to be able to get it running well.

I use the same token (from source the admin one), I do not understand why I get Unauthorized error message.

I have this error message: “Error: failed to restore KV snapshot: 401 Unauthorized …”
image

Here is my backup command line

influx backup “Backup_Dir” --token “xxxxxxxxxxxxxxx9oNPSDLUbpj0gk7G_d9-auS5o_eMX2ssr0lPwvcOgJK7qPAqYPW701C-6berKIkWN08yNLA==”

Here is my restore coommand line using the same token

influx restore Backup_Dir --full --token "xxxxxxxxxxxxxxx9oNPSDLUbpj0gk7G_d9-auS5o_eMX2ssr0lPwvcOgJK7qPAqYPW701C-6berKIkWN08yNLA==”

Hi Team,

Do you have any advice to solve this issue.
It’s strange to not be able to BAckup and restore from v2.4 to v2.7 installed to new fresh server, using Token admin from original v2.4 release

Thanks in advance for your help,
I’m at risk on my old machine and really need to move the latest Influxdb OSS release

Found the solution, easy to do if you know.

from v2.0 to v2.4 when you restore a DB to new server, you just need to include “–token” reference of your source admin’s token db and all the full restore to new server is accomplished using source token.

With v2.7 you MUST before set the initial token before to do any restore action.
This token generation must be done before any UI Web login, because if you login first time, an automatic token is created and you will never be able to restore your DB from previous server (full restore)

Again easy when you know that.
We can find the solution using this URL https://docs.influxdata.com/influxdb/v2/admin/backup-restore/restore/ and especialy this section

influx setup --token My5uP3rSecR37t0keN
This command line will set the admin token and start a wizard with question about initial set of DB.

Restore to a new InfluxDB server
If using a backup to populate a new InfluxDB server:

Retrieve the admin token from your source InfluxDB instance.

Set up your new InfluxDB instance, but use the -t, --token flag to use the admin token from your source instance as the admin token on your new instance.

influx setup --token My5uP3rSecR37t0keN
Restore the backup to the new server.

influx restore \
  /backups/2020-01-20_12-00/ \
  --full
If you do not provide the admin token from your source InfluxDB instance as the admin token in your new instance, the restore process and all subsequent attempts to authenticate with the new server will fail.

The first restore API call uses the auto-generated token to authenticate with the new server and overwrites the entire key-value store in the new server, including the auto-generated token.
The second restore API call attempts to upload time series data, but uses the auto-generated token to authenticate with new server. That token is overwritten in first restore API call and the process fails to authenticate.
1 Like