How to view & interpret disk space usage of your ElasticSearch cluster
In order to find out how much disk space every node of your elasticsearch cluster is using and how much disk space is remaining, use
curl -XGET "http://localhost:9200/_cat/allocation?v&pretty"
Example output for one node without any data:
shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
0 0b 2.4gb 200.9gb 203.3gb 1 172.18.0.2 172.18.0.2 TxYuHLF
This example output tells you:
shards: 0
The cluster currently has no shards. This means there is no data in the clusterdisk.indices: 0b
The cluster currently uses 0 bytes of disk space for indexes.disk.used: 2.4gb
The disk ElasticSearch will store its data on has 2.4 Gigabytes used spaced. This does not mean that ElasticSearch uses 2.4 Gigabytes, any other application (including the operating system) might also use (part of) that space.disk.avail: 200.9gb
The disk ElasticSearch will store its data on has 200.9 Gigabytes of free space. Remember that this will not shrink only if ElasticSearch is using data on said disk, other applications might also consume some of the disk space depending on how you set up ElasticSearch.disk.total: 203.3gb
The disk ElasticSearch will store its data on has a total size of 203.3 gigabytes (total size as in available space on the filesystem without any files)disk.percent: 1
Currently 1 % of the total disk space available (disk.total
) is used. This value is always rounded to full percents.host, ip, node
: Which node this line is referring to.
Example with one node with some test data (see this TechOverflow post on how to generate test data):
shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
5 6.8kb 2.4gb 21.6gb 24gb 10 172.18.0.2 172.18.0.2 J3W5zqj
5 UNASSIGNED
As we can see, ElasticSearch now has 5 shards. Note that the second line tells us that 5 shards are UNASSIGNED
. This is because ElasticSearch has been configured to make one replica for each shard and there is no second node where it can put the replica. For development configurations this is usually OK, but production configurations should usually have at least two nodes. See our docker-compose and systemd service generator for ElasticSearch for instructions on how to configure a local multi-node cluster using docker.