Jaap Weijland
Jaap Weijland

Reputation: 3357

InfluxDB storage size on disk

All I want is simply to know how much space my InfluxDB database takes on my HDD. The stats() command gives me dozens of numbers but I don't know which one shows what I want.

Upvotes: 48

Views: 81350

Answers (4)

Munin
Munin

Reputation: 1639

In InfluxDB v1.x, you can use following command to find out the disk usage of database, measurement and even shards:

influx_inspect report-disk -detailed /var/lib/influxdb/data/

enter image description here

In InfluxDB v2.x, you could take advantage of the internal stats as following:

from(bucket: "yourBucket")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r["_measurement"] == "storage_shard_disk_size")
    |> filter(fn: (r) => r["_field"] == "gauge")
    |> last()

It will show you the size of each database. enter image description here

Upvotes: 3

xealits
xealits

Reputation: 4556

Also check .influxdb in your user's home directory.

If you already run influxd, you can check which file descriptors it keeps open:

$ pgrep -a influxd
<influxd PID> <full command path>
$ ls -l /proc/<influxd PID>/fd

For example, I have an influxd from a prebuilt package influxdb-1.8.6_linux_amd64.tar.gz. It is simply unpacked in /home/me/bin/ and runs as a user command. There is neither /var/lib/influxdb/ nor /etc/influxdb/influxdb.conf. There is ~/bin/influxdb-1.8.6-1/etc/influxdb/influxdb.conf, but it is not actually used. However, the list of file descriptors in /proc/<PID>/fd shows that it keeps several files opened under:

/home/me/.influxdb/data
/home/me/.influxdb/data/<my_db_name>/_series
/home/me/.influxdb/wal/<my_db_name>/

But do not take this for granted, I am not an influxdb expert. Notice that 1.8 is an old version, there might be some tricks in other versions.

Upvotes: 1

William Reid
William Reid

Reputation: 1

For InfluxDB 2.0 on MacOS - (for me at least) - the location is ~/.influxdbv2/engine.

Running "du -sh *" will show you the disk usage.

Upvotes: 0

danny
danny

Reputation: 5270

Stats output does not contain that information. The size of the directory structure on disk will give that info.

du -sh /var/lib/influxdb/data/<db name>

Where /var/lib/influxdb/data is the data directory defined in influxdb.conf.

Upvotes: 80

Related Questions