I stored data and it’s all going to var\lib\influxdb\wal which makes sense since its the most recent data will be stored in the cache. But when I inserted more data the amount of space var\lib\influxdb declined…It’s not in var\lib\influxdb\data or /wal . Where is the data stored? It first stored in wal then goes to data?
Correct. The data is written to the WAL first and will be stored under the
\wal directory. Once it’s flushed from the WAL, it will be written to
.tsm files under the
\data directory. There are several reasons for decreases in size from WAL to data: 1) the WAL data is compressed in blocks using Snappy 2) when the WAL is flushed, different compression is used, and 3) compactions, which happen automatically in the background.
Thank you. So how does influxDB determine when to flush from WAL to data directory?
There are two config options that control writes of WAL data to
.tsm files in the
[data] cache-snapshot-memory-size = 26214400 cache-snapshot-write-cold-duration = "10m0s"
Those are the default values (25MB or 10 minutes).
Is there any way that I can change the path / location of data directory? In my case, .tsm files are stored at C:\Windows\System32\config\systemprofile.influxdb\data\telegraf\autogen.
@amritanshkr there are configuration options for where data is stored. If you’re starting with a config file already (
influxd -config <path\to\config>) then edit that file. If you’re running with default config (starting
influxd with no flags), then you’ll need to generate a config file by running
influxd config > influxd.conf and editing the following settings:
[data] dir=<path\to\data> wal-dir=<path\to\wal>
The config file settings are documented here.