Trying to run elasticsearch locally for development using docker compose (Getting started with the Elastic Stack and Docker-Compose | Elastic Blog)
I end up getting disk pressure issues, well a warning, but it ends up meaning a dysfunctional es when you try adding indexes and data.
elasticsearch-es01-1 | {"@timestamp":"2023-12-17T21:46:42.285Z", "log.level": "WARN", "message":"high disk watermark [90%] exceeded on [8QrPMNt3TZ2KKJrckbbXOg][es01][/usr/share/elasticsearch/data] free: 14.9gb[6.4%], shards will be relocated away from this node; currently relocating away shards totalling [0] bytes; the node is expected to continue to exceed the high disk watermark when these relocations are complete", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es01][masterService#updateTask][T#1]","log.logger":"org.elasticsearch.cluster.routing.allocation.DiskThresholdMonitor","elasticsearch.cluster.uuid":"Xjc0-pxlSyqehu4SKDBvfw","elasticsearch.node.id":"8QrPMNt3TZ2KKJrckbbXOg","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"docker-cluster"}
To stop this happening you can configure the following, but that just avoids the real issue.
curl -XPUT "http://localhost:9200/_cluster/settings" \
-H 'Content-Type: application/json' -d'
{
"persistent": {
"cluster": {
"routing": {
"allocation.disk.threshold_enabled": false
}
}
}
}'
The real issue is that the docker image thinks it has used up all the space, whereas docker demon correctly says what it is actually using.
docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
8b4f21221f4f docker.elastic.co/elasticsearch/elasticsearch:8.11.3 "/bin/tini -- /usr/l…" 8 minutes ago Up 8 minutes (healthy) 0.0.0.0:9200->9200/tcp, 9300/tcp elasticsearch-es01-1 246kB (virtual 797MB)
0fe87d614464 docker.elastic.co/elasticsearch/elasticsearch:8.11.3 "/bin/tini -- /usr/l…" 8 minutes ago Up 8 minutes (healthy) 9200/tcp, 9300/tcp elasticsearch-setup-1 688MB (virtual 1.49GB)
Looks normal, but lets look inside the running container
docker exec -it 8b4f21221f4f /bin/bash
elasticsearch@8b4f21221f4f:~$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 234G 207G 15G 94% /
tmpfs 64M 0 64M 0% /dev
shm 64M 0 64M 0% /dev/shm
/dev/vda1 234G 207G 15G 94% /etc/hosts
tmpfs 20G 0 20G 0% /sys/firmware
Has anyone else experienced this scenario?