Create a new directory in which you want to put your data and set the appropriate permissions, for example:
mkdir /mnt/mydrive/influxdb sudo chown influxdb:influxdb influxdb
Edit the following three lines of your /etc/influxdb/influxdb.conf ( /usr/local/etc/influxdb.conf on macOS) so that they point to your new location:
# under [meta] dir = "/new/path/to/influxdb/meta" # under [data] dir = "/new/path/to/influxdb/data" wal-dir = "/new/path/to/influxdb/wal"
Restart the InfluxDB daemon.
sudo service influxdb restart
Done!
If you want to move existing data, just copy the existing data (the location can be found in influxdb.conf ; /var/lib/influxdb on Ubuntu / Debian) to your new desired location before editing influxdb.conf and make sure that the new folder has the appropriate permissions /ownership.
There is some information about backup / restore in official documents, however simple copying worked for me.
Please let me know if there are errors in the above procedures. This has been tested on InfluxDB v0.12 on macOS / Ubuntu / Raspbian.
source share