Upgrade Influx 1.8.10 to 2.x failed

Hello, I have a vm with the following characteristics:

NAME=“CentOS Linux”
VERSION=“7 (Core)”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“7”
PRETTY_NAME=“CentOS Linux 7 (Core)”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:centos:centos:7”
HOME_URL=“”
BUG_REPORT_URL=“”

CENTOS_MANTISBT_PROJECT=“CentOS-7”
CENTOS_MANTISBT_PROJECT_VERSION=“7”
REDHAT_SUPPORT_PRODUCT=“centos”
REDHAT_SUPPORT_PRODUCT_VERSION=“7”

Version of influx:
influx --version
InfluxDB shell version: 1.8.10

dir = “/var/lib/influxdb/meta”
dir = “/var/lib/influxdb/data”
wal-dir = “/var/lib/influxdb/wal”
auth-enabled = false

Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10

show users;
user admin


user true

I understand that version 2 cannot be installed, since I have seen that on some websites v2 is installed and then they execute the upgrade command. in this case, you have to uninstall v1.8.10 and install v2.1.1

so I install v2, deleting the previous one but having the data (paths)
influxd version
InfluxDB 2.1.1 (git: 657e1839de)

according to the website now you have to do an influxd upgrade, but it gives me an error and does not update

influxd upgrade
Error: 1.x DB dir ‘/home/user/.influxdb’ does not exist
See ‘influxd -h’ for help

any can help me?

Hi @robbyq92,
Following these steps in the documentation you only need to stop your InfluxDB 1.X instance: Perform the upgrade. Did you perform a backup of 1.X via this command in the instructions:

cp -R .influxdb/ .influxdb_bak/

If so I would simply make another copy of this with the original name again and try the upgrade process. If you have fully uninstalled 1.8 however this might become an issue.

Thnks for reply @Jay_Clifford

I have to uninstall version 1.8 to install version 2.1, through yum… or through .rpm (yum localinstall .rpm)

Because if I stop influx 1.8.x and do an influxdb upgrade, the command is not recognized.

EDIT:
I did the following:
I have influxdb 1.8.10 and I want to upgrade to 2.1

I have the influxdb 1.8.10 backup.
I have stopped the service
I have downloaded the binary and unzipped it
I have entered inside the uncompressed path and I have the influxd (2.1.1) and I execute the ./influxd upgrade

[code] sudo ./influxd upgrade
{“level”:“info”,“ts”:1647939086.8667152,“caller”:“upgrade/upgrade.go:402”,“msg”:“Starting InfluxDB 1.x upgrade”}
{“level”:“info”,“ts”:1647939086.866802,“caller”:“upgrade/upgrade.go:405”,“msg”:“Upgrading config file”,“file”:“/etc/influxdb/influxdb.conf”}
{“level”:“info”,“ts”:1647939086.8672688,“caller”:“upgrade/upgrade.go:409”,“msg”:“Config file upgraded.”,“1.x config”:“/etc/influxdb/influxdb.conf”,“2.x config”:“/root/.influxdbv2/config.toml”}
{“level”:“info”,“ts”:1647939086.867286,“caller”:“upgrade/upgrade.go:419”,“msg”:“Upgrade source paths”,“meta”:“/var/lib/influxdb/meta”,“data”:“/var/lib/influxdb/data”}
{“level”:“info”,“ts”:1647939086.867296,“caller”:“upgrade/upgrade.go:420”,“msg”:“Upgrade target paths”,“bolt”:“/root/.influxdbv2/influxd.bolt”,“engine”:“/root/.influxdbv2/engine”}
{“level”:“info”,“ts”:1647939086.909203,“caller”:“bolt/bbolt.go:83”,“msg”:“Resources opened”,“service”:“bolt”,“path”:“/root/.influxdbv2/influxd.bolt”}
{“level”:“info”,“ts”:1647939086.9192967,“caller”:“migration/migration.go:175”,“msg”:“Bringing up metadata migrations”,“service”:“migrations”,“migration_count”:18}

Welcome to InfluxDB 2.0!
? Please type your primary username user
? Please type your password **********
? Please type your password again **********
? Please type your primary organization name im
? Please type your primary bucket name im
? Please type your retention period in hours, or 0 for infinite 0
? Setup with these parameters?
Username: user
Organization: im
Bucket: im
Retention Period: infinite
Yes
{“level”:“info”,“ts”:1647939226.2515893,“caller”:“upgrade/setup.go:73”,“msg”:“CLI config has been stored.”,“path”:“/root/.influxdbv2/configs”}
{“level”:“info”,“ts”:1647939226.251667,“caller”:“upgrade/database.go:202”,“msg”:“Checking available disk space”}
{“level”:“info”,“ts”:1647939226.2543473,“caller”:“upgrade/database.go:223”,“msg”:“Computed disk space”,“free”:“24 GB”,“required”:“565 MB”}
? Proceeding will copy all V1 data to “/root/.influxdbv2”

Space available: 24 GB
Space required: 565 MB
Yes
{“level”:“info”,“ts”:1647939240.3682117,“caller”:“upgrade/database.go:51”,“msg”:“Upgrading databases”}
{“level”:“warn”,“ts”:1647939240.4192066,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.4606638,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.495276,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.5332541,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.7229803,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.7699192,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.804222,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.8655705,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.9048724,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.942009,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“warn”,“ts”:1647939240.9749124,“caller”:“upgrade/database.go:158”,“msg”:“Empty retention policy”}
{“level”:“info”,“ts”:1647939251.475856,“caller”:“upgrade/database.go:195”,“msg”:“Database upgrade complete”,“upgraded_count”:15}
{“level”:“info”,“ts”:1647939251.4759476,“caller”:“upgrade/security.go:45”,“msg”:“Upgrading 1.x users”}
{“level”:“warn”,“ts”:1647939251.503806,“caller”:“upgrade/security.go:50”,“msg”:“User is admin and will not be upgraded”,“username”:“user”}
{“level”:“info”,“ts”:1647939251.5285735,“caller”:“upgrade/security.go:115”,“msg”:“User upgrade complete”,“upgraded_count”:2}
{“level”:“warn”,“ts”:1647939251.5286121,“caller”:“upgrade/upgrade.go:484”,“msg”:“1.x users were upgraded, but 1.x auth was not enabled. Existing clients will fail authentication against 2.x if using invalid credentials”}
{“level”:“info”,“ts”:1647939251.5286314,“caller”:“upgrade/upgrade.go:489”,“msg”:“Upgrade successfully completed. Start the influxd service now, then log in”,“login_url”:“localhost:8086”}

[/code]

but now what i need to do? remove influxdb 1.8.10? install 2.1 and i have the new config?

Only do this on a fresh influxdb2 install:
Tested on amazonlinux2. All steps should work for rpm distros: fedora, centos, redhat, OEL, etc.

– Do a fresh Install influxdb2 and influxdb2-cli
– If your influxdb2 is currently running, turn it off
– chown -R influxdb:influxdb all your influxdb1.8 data
– Perform the upgrade:

  • sudo -u influxdb influxd --v1-dir /path/to/influxdb1.8/data upgrade
  • follow the prompts for your new user, password, org, etc
  • rsync -azvpP /var/lib/influxdb/.influxdbv2/ /var/lib/influxdb/
  • start influxdb. This initial start may take a while depending on how much data you have. Don’t be surprised if systemd times out. You can always update your influxdb unit file [service]TimeoutSec=1000 or something.

If you want to make the CLI usable, you need to login to the webUI and copy out the API token you just created and export these env variables in terminal:
export INFLUX_TOKEN="<api_token>"
export INFLUX_HOST="<http/https>://localhost:8086"
export INFLUX_USERNAME="<api_token_username>"
You can try just adding the above values to /etc/default/influxdb2 but I haven’t had any luck with it.

If you want to use TLS, drop your certificates + key where you want them and add these lines to your /etc/influxdb/config.toml file:
tls-cert = “/path/to/certs/cert.{pem,crt}”
tls-key = “/path/to/cert/key/cert_key.key”

If you’re using a self signed cert you’ll have to use “–skip-verify” at the end of every influx command you run.

4 Likes

This is perfect,

just i configure this:

sudo -u influxdb influxd **upgrade** --v1-dir /path/to/influxdb1.8/data upgrade

but i have one problem, for example i have one db with unix metrics, this db i dont see in my new influx.

only i can see the new bucket created in setup. The data movin in process? i losee my data?

thanks all in advance