Elasticsearch volume and memory (Docker)
The Elasticsearch container holds vital Dataset data. Before any container maintenance, make sure the Elasticsearch data directory is mapped to the Linux host, so the data survives when the container is removed for maintenance or upgrades.
The examples below show an image: line for illustration. Keep it matching the Elasticsearch version your installation actually runs.
Add an Elasticsearch volume mount to the host
-
From the Informer install root on the host, create a directory for the Elasticsearch data:
mkdir esdata -
Stop Informer and bring up only Elasticsearch:
docker-compose stopdocker-compose start <elasticsearch service name> -
Copy the Elasticsearch data from the container to the host's
esdata:docker cp <elasticsearch container name>:/usr/share/elasticsearch/data/. ./esdata -
Edit
docker-compose.ymland add the volume mount to the Elasticsearch service:elasticsearch:environment:- TZ=timezonegoeshere- ES_JAVA_OPTS=-Xms4g -Xmx4gvolumes:- ./esdata:/usr/share/elasticsearch/data -
Recreate the Elasticsearch container with the new mount:
docker-compose stopdocker-compose rm <elasticsearch service name>docker-compose up -d
Once Informer is back online, confirm Datasets still have query data, which proves the data persisted to the host mount.
Increase Elasticsearch memory
Elasticsearch is memory-intensive and is often the bottleneck for queries. By default it uses 2 GB, which is usually not enough; the minimum recommended is 4 GB, and 8 GB is common where resources allow.
Elasticsearch consumes all of its configured memory at startup and holds it. Never allocate more than 50% of the server's memory to Elasticsearch, and account for total server usage.
Make sure the Elasticsearch data directory is mounted to the host (above) before continuing.
-
Stop the system:
docker-compose stop -
Edit
docker-compose.ymland set the memory in the Elasticsearch service's environment, changing4gto the desired amount (the same value for-Xmsand-Xmx):elasticsearch:environment:- TZ=timezonegoeshere- ES_JAVA_OPTS=-Xms4g -Xmx4gvolumes:- ./esdata:/usr/share/elasticsearch/data -
Recreate the Elasticsearch container:
docker-compose rm <elasticsearch service name>docker-compose up -d -
Follow the Elasticsearch logs to confirm the new memory settings on startup (look for the
-Xms/-Xmxvalues in the JVM arguments):docker-compose logs -f elasticsearch