virtualMachineinfluxdb

Upgrade InfluxDB 1.x data into 2.x format

InfluxDB 2.x includes an internal command to upgrade data from 1.x format into 2.x. We highly recommend you to create a full backup of your machine before performing any changes in this guide.

Place the 1.x data in a well-known directory and follow the next steps to import and migrate the data:

  • Stop InfluxDB
sudo /opt/bitnami/ctlscript.sh stop
  • Backup current 2.x data
sudo mv /opt/bitnami/influxdb/etc/config.yaml{,.bck}
sudo mv /bitnami/influxdb{,.bck}
  • Recreate the root data folder
sudo mkdir -p /bitnami/influxdb
  • Run the influxd upgrade command as shown below. Remember to replace the different placeholders
sudo influxd upgrade \
  --force \
  --org "primary" \
  --bucket "primary" \
  --username admin \
  --password "INFLUXDB_ADMIN_PASSWORD" \
  --retention 0 \
  --v2-config-path /opt/bitnami/influxdb/etc/config.yaml \
  --influx-configs-path /bitnami/influxdb/configs \
  --continuous-query-export-path "/tmp/cq-v1.txt"
  --log-path /tmp/upgrade.log \
  --bolt-path /bitnami/influxdb/influxd.bolt \
  --engine-path /bitnami/influxdb
  --v1-dir PATH_TO_V1_DATA \
  --log-level debug \
  --token "INFLUXDB_ADMIN_TOKEN" \
  --overwrite-existing-v2
  • Fix filesystem permissions
sudo chown -R influxdb:root /bitnami/influxdb
  • Start the service again
sudo /opt/bitnami/ctlscript.sh start

After that, the InfluxDB server will include the migrated data. You will also find the full upgrade log at /tmp/upgrade.log for further reference.

Last modification May 28, 2024