Move InfluxDB Data

(Arethusa) #1


I want to move the influxDB data.

By default, they are on /var/lib/influxdb

I see 3 folder in influxdb.conf:

dir = "/var/lib/influxdb/meta" 
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"

the most important file on size is /var/lib/influxdb/data/icinga2/autogen

I want move the data on dedicated partition : "/data"

I have try to change dir = "/var/lib/influxdb/data" on dir = "/data/influxdb/data"

That works but the dashboard on grafana start from begin, and I can’t see the older graph (It’s logical).

So how can I move all data (or just the autogen file) on a new partition (/data) without lossing graph ?

For yet, I just rollback my test to restaur my all data

Thank You.

(Roland Sommer) #2

What about mounting the dedicated partition on /var/lib/influxdb?

1 Like
(Arethusa) #3

It’s interesting, but I already have a /data and I have to used it.

Thank you for your relevant answer.

(Arethusa) #4

I try a simple thing, but that fail:

systemctl stop influxdb
mkdir /data/influxdb
chown influxdb:influxdb /data/influxdb
cp -R /var/lib/infuxdb/* /data/influxdb/
systemctl start influxdb

But I have nothing on my dashboard so I rollback.

Do i forget something?


(Carsten Köbke) #5

You should change your influxdb.conf. There are 3 Config options that need to change:

dir = "/data/influxdb/meta"
  dir = "/data/influxdb/data"
  wal-dir = "/data/influxdb/wal"

More information about influxdb can be found in the docs

1 Like
(Arethusa) #6

Yes, I do it (I explain on my fist message), but that did not work.

Thank you.

(Carsten Köbke) #7

Anything in the logs?

(Arethusa) #8

It’s my fault…

I do chown influxdb:influxdb /data/influxdb

But I have to do chown -R influxdb:influxdb /data/influxdb

The other mistake is to do the chown BEFOR the cp -R. I copy with root user so the created file are root:root.

In conclusion, to change influxdb directory:

Change the /etc/influxdb/influxdb.conf:

dir = "/data/influxdb/meta"
  dir = "/data/influxdb/data"
  wal-dir = "/data/influxdb/wal"

And after:

# systemctl stop influxdb
# mkdir /data/influxdb
# cp -R /var/lib/infuxdb/* /data/influxdb/
# chown influxdb:influxdb /data/influxdb
# systemctl start influxdb

Thank you for you High availability.

1 Like