Upgrade from InfluxDB 1.1 to 1.7

#1

Dear community,

Currently I am building a weather IoT project, using Influx and Grafana to present the data. After some investigation I settled on a DigitalOcean Ubuntu 18.04 droplet. I don’t know anything about Linux but luckily I found an online tutorial on how to install Influx and Grafana. It’s running great for a month or so but looking for the ABS() function, I found out that the Influx version the tutorial was for, was 1.1! ABS didn’t exist in that version.

Is there a way to upgrade to the latest version without losing data / the database? What steps do I need to take? I have looked at the documentation but it’s not clear if for example I have to take “${DISTRIB_ID,} ${DISTRIB_CODENAME}” literally or I have to substitute it with some values. Again, I have no Linux experience at all. I would like to keep the data.

Any help is highly appreciated. Thanks in advance.

#2

To be more concrete:
The documentation says:
curl -sL .key | sudo apt-key add -
source /etc/lsb-release
echo “deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable” | sudo tee /etc/apt/sources.list.d/influxdb.list

while the download page says:
wget ://dl.influxdata.com/influxdb/releases/influxdb_1.7.0_amd64.deb
sudo dpkg -i influxdb_1.7.0_amd64.deb

Is that installing versus downloading? But sudo dpkg seems to be installing as well?
I will understand it if you say learn Linux first before starting to mess with this but I haven’t had time yet and still hope some help is available here. :slight_smile:

(I removed the links because I am not allowed to have more than two)

#3

The variables like ${DISTRIB_CODENAME} are set by the source /etc/lsb-release command, so type the lines literally.

To explain more about these two options, these are both valid ways of installing the package but the former way will allow you to update it in the same way and along with other system updates, which is usually done like so:

sudo apt-get update
sudo apt-get upgrade

The later method would require you to perform these steps each time you wish to upgrade, but it would give you a bit more control over the exact version you use.

You should be able to update using either method without losing any data.

#4

Thanks a lot for your help, Daniel. I really felt embarrassed to ask.

Anyway, you eased my fear and I just took the plunge. However, it didn’t go as expected in the sense that using the one with ${DISTRIB_ID and $[DISTRIB_CODENAME, I saw:
Preparing to unpack …/influxdb_1.6.4-1_amd64.deb …
That’s not version 1.7, I assume, so I wonder what went wrong.
Then I got this error:

Unpacking influxdb (1.6.4-1) over (1.1.1+dfsg1-4) …
dpkg: error processing archive /var/cache/apt/archives/influxdb_1.6.4-1_amd64.de b (–unpack):
trying to overwrite ‘/usr/bin/influx’, which is also in package influxdb-client 1.1.1+dfsg1-4
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
influxdb.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable influxdb
/usr/bin/deb-systemd-helper: error: unable to read influxdb.service
Errors were encountered while processing:
/var/cache/apt/archives/influxdb_1.6.4-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

So, when I type
$ influxd version
I get:
InfluxDB v1.1.1 (git: unknown unknown)

That doesn’t seem to be a successful upgrade?

#5

Then I tried the other one:

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.7.0_amd64.deb
sudo dpkg -i influxdb_1.7.0_amd64.deb

I got a similar result:

$ sudo dpkg -i influxdb_1.7.0_amd64.deb
(Reading database … 91820 files and directories currently installed.)
Preparing to unpack influxdb_1.7.0_amd64.deb …
Unpacking influxdb (1.7.0-1) over (1.1.1+dfsg1-4) …
dpkg: error processing archive influxdb_1.7.0_amd64.deb (–install):
trying to overwrite ‘/usr/bin/influx’, which is also in package influxdb-client 1.1.1+dfsg1-4
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
influxdb.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable influxdb
/usr/bin/deb-systemd-helper: error: unable to read influxdb.service
Processing triggers for man-db (2.8.3-2) …
Errors were encountered while processing:
influxdb_1.7.0_amd64.deb

Hope that anyone can explain me what I am doing wrong?

#6

I think you will need to remove the influxdb-client package before upgrading:

sudo dpkg -P influxdb-client
sudo dpkg -i influxdb_1.7.0_amd64.deb
#7

Wow, Daniel, that did it. Up and running on 1.7 now. Thanks a lot for your help, much appreciated!