I've Installed package from the official site by instruction. By default the physical destination of database folder is /opt/influxdb/shared
.
I've tried to change properties of config file and written it properly. But after that I can't start the influxdb service.
[storage] dir = "/media/alex/Second/InfluxStorage/data/db" //my settings
How I can change the default database directory ?
In the default configurations for Windows, the data is stored in the directory c:\Users\<username>\. influxdb\data\ .
InfluxDB stores data in shard groups. Shard groups are organized by retention policy (RP) and store data with timestamps that fall within a specific time interval called the shard duration. The shard group duration is also configurable per RP.
EDIT: This is for InfluxDB v1.x only. It has been reported to not work for InfluxDB v2.x.
Make a new directory where you want to put your data and set the appropriate permissions, e.g.:
mkdir /new/path/to/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!
In case you want to move existing data, just simply copy the existing data (location can be found at influxdb.conf
; /var/lib/influxdb
on Ubuntu/Debian) to your new desired location before editing influxdb.conf
and make sure the new folder has the appropriate permissions/ownership.
There is some information about backups/restores on the official docs, however just plain copying worked for me.
The above was tested on InfluxDB v1.2 on macOS/Ubuntu/Raspbian.
For InfluxDB 2.0:
In InfluxDB 2.0 the data directories are below ~/.influxdbv2
by default.
Actually, there are 2 data storages for bolt (various key-value configurations) and engine (the TSM database).
From the documentation, to change the location to the bolt database:
~/.influxdbv2/influxd.bolt
influxd --bolt-path=~/.influxdbv2/influxd.bolt
export INFLUXD_BOLT_PATH=~/.influxdbv2/influxd.bolt
bolt-path: /users/user/.influxdbv2/influxd.bolt
From the documentation, to change the location to the engine database:
~/.influxdbv2/engine
influxd --engine-path=~/.influxdbv2/engine
export INFLUXD_ENGINE_PATH=~/.influxdbv2/engine
engine-path: /users/user/.influxdbv2/engine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With