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.

4 Answers

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.

3

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

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.

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

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like