Confused about where the data from databased is being stored

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 directory:

  cache-snapshot-memory-size = 26214400
  cache-snapshot-write-cold-duration = "10m0s"

Those are the default values (25MB or 10 minutes).

Hi @dgnorton,
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:


The config file settings are documented here.

Hi, I use influxDB on MacOS with openHAB. I let it run several days to persist lots of data which I can query in the CLI and I also see it in Grafana.
Still, the folders /usr/local/var/influxdb/data and wal are empty. Only /meta contains a .db file with 20 byte (way too little for my data). Can anybody tell where the data is stored that I query? In the .conf it says:

  # The directory where the TSM storage engine stores TSM files.
  dir = "/usr/local/var/influxdb/data"

  # The directory where the TSM storage engine stores WAL files.
  wal-dir = "/usr/local/var/influxdb/wal"

On macOS everything is stored in ~/.influxdb/. You will find both data and wal directories there.

Ah, I see. Thanks for the fast reply!

I find the files there. Does that mean I cannot change the location where the database is stored?

I would like to replicate the data so it’s more failure secure but want to keep it a single node solution. My idea was to just store the database in my cloud folder so the cloud service replicates it automatically for me. Is that possible or is there an easy alternative for my goal?