How to change the location of the Influxdb storage folder?

I installed the package from the official site according to the instructions. By default, the physical destination of the database folder is "/ opt / influxdb / shared".

I tried to change the properties of the configuration file and write it correctly. But after that I can not start the infuxdb service.

[storage]

dir = "/ media / alex / Second / InfluxStorage / data / db" // my settings

How can I change the default database directory?

+6
source share
1 answer

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 # Ubuntu/Debian brew services restart influxdb # macOS/homebrew 

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.

+5
source

Source: https://habr.com/ru/post/982060/


All Articles