We have a ELK cluster with single node having 50gb disk space. We are sending metricbeat data from 200 servers to Elasticsearch.
Created an ILM policy for metricbeat index to do a rollover and delete the index after it crosses 5GB.
ILM is doing the index rollover and deletion but still we are not able to get back the disk space back.
Eventually disk percent used is increasing each day and after few days, disk is completely filled up.
Why ILM policy is not deleting the data and reclaiming space?
I do not know what is actually taking the space, it could be any number of things.
I can say that when an index is deleted the disk space is reclaimed almost immediately so the source of your rising disk usage is probably something else.
@stephenb I got the disk space back when I used the command :
docker system prune --volumes -f
Could you please suggest what might be the reason behind it?
Well That explains it.. you did not say you are running inside docker.
As you found out Docker manages the Docker container Volume size not Elasticsearch.
Also it is not best use the internal docker container volume for the elasticsearch data. best practice is to mount the elastic data path to a volume on the host.
See Here
Always bind data volumes
You should use a volume bound on /usr/share/elasticsearch/data for the following reasons:
The data of your Elasticsearch node won’t be lost if the container is killed
Elasticsearch is I/O sensitive and the Docker storage driver is not ideal for fast I/O
@stephenb Thanks a lot!
I will definitely look into the options which you provided and will try to implement what you suggested. Hope that will resolve this issue.
For your reference, I am providing my docker compose file below:
@stephenb I believe the docker compose file which I shared is already using a mount for the volume. We basically don't want to store this data at all.
Could you please suggest?
This is because you are using a named volume mount with docker and elastic so elastic data is still within the docker environment and the volume (space) is managed by docker
As opposed a bind mount where the data is external to a docker volume i.e. mounted on the local host.
Hi @stephenb I created the external volume as you suggested earlier. Also updated the docker compose file with the details.
Still I am facing the same disk space issue.
Suppose the host path is : /usr/share/Elasticsearch/data.
If I run the remove command:
rm -rf /usr/share/Elasticsearch/data
Then I am able to delete the data and spin up the containers again. Otherwise ILM even after doing the rollover and delete, it is not reclaiming the disk space back. Please find the below snaps:
They are tiny 57mb... certainly not 7.6GB... .what is going on ....
Ahhh the 7.6GB disk usage being reported by Elasticsearch Cat Nodes / Allocation reports on the Docker Disk Container Filesystem that Elasticsearch is running in NOT the Host local disk...
So you will never see the Local Host Disk usage from Within Elasticsearch Running inside Docker... It can...not...see... it.
Elasticsearch only see the "local" filesystem which is docker owned... nothing Elasticsearch can do about that.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.