hi
I have a vm wiht 16gb. i need to reduce its memory consumption. for some reasons manually specifying Xmx1g and Xms1g (or any other value) breaks the elasticsearch. the service wont start. commenting this setting in /etc/elasticsearch/jvm.option file or creating a seperate file in /etc/elasticsearch/elasticsearch.d/heap.options has same affect.
root@elastic:/home/netflow# java --version
openjdk 11.0.25 2024-10-15
OpenJDK Runtime Environment (build 11.0.25+9-post-Ubuntu-1ubuntu124.04)
OpenJDK 64-Bit Server VM (build 11.0.25+9-post-Ubuntu-1ubuntu124.04, mixed mode, sharing)
root@elastic:/home/netflow# nano /etc/elasticsearch/jvm.options.d/heap.options
GNU nano 7.2 /etc/elasticsearch/jvm.options.d/heap.options
-Xms1g
-Xmx1g
jvm.option file
## GC configuration
8-13:-XX:+UseConcMarkSweepGC
8-13:-XX:CMSInitiatingOccupancyFraction=75
8-13:-XX:+UseCMSInitiatingOccupancyOnly
## G1GC Configuration
# NOTE: G1 GC is only supported on JDK version 10 or later
# to use G1GC, uncomment the next two lines and update the version on the
# following three lines to your version of the JDK
# 10-13:-XX:-UseConcMarkSweepGC
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
14-:-XX:+UseG1GC
## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}
## heap dumps
# generate a heap dump when an allocation from the Java heap fails; heap dumps
# are created in the working directory of the JVM unless an alternative path is
# specified
-XX:+HeapDumpOnOutOfMemoryError
# exit right after heap dump on out of memory error. Recommended to also use
# on java 8 for supported versions (8u92+).
9-:-XX:+ExitOnOutOfMemoryError
# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=/var/lib/elasticsearch
# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log
## JDK 8 GC logging
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:/var/log/elasticsearch/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m
# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
# workaround G1 bug, see https://bugs.openjdk.org/browse/JDK-8329528
22:-XX:+UnlockDiagnosticVMOptions
22:-XX:G1NumCollectionsKeepPinned=10000000
root@elastic:/home/netflow# journalctl -xeu elasticsearch.service
░░ An ExecStart= process belonging to unit elasticsearch.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 26 20:27:58 elastic systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit elasticsearch.service has entered the 'failed' state with result 'exit-code'.
Nov 26 20:27:58 elastic systemd[1]: Failed to start elasticsearch.service - Elasticsearch.
░░ Subject: A start job for unit elasticsearch.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit elasticsearch.service has finished with a failure.
░░
░░ The job identifier is 1101 and the job result is failed.
Nov 26 20:27:58 elastic systemd[1]: elasticsearch.service: Consumed 2.227s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit elasticsearch.service completed and consumed the indicated resources.
Nov 26 20:44:30 elastic systemd[1]: Starting elasticsearch.service - Elasticsearch...
░░ Subject: A start job for unit elasticsearch.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit elasticsearch.service has begun execution.
░░
░░ The job identifier is 1435.
Nov 26 20:44:31 elastic systemd-entrypoint[2405]: encountered [2] errors parsing [/etc/elasticsearch/jvm.options.d/heap.options]
Nov 26 20:44:31 elastic systemd-entrypoint[2405]: [1]: encountered improperly formatted JVM option in [/etc/elasticsearch/jvm.options.d/heap.options] on line number [1]: [ -Xms4g]
Nov 26 20:44:31 elastic systemd-entrypoint[2405]: [2]: encountered improperly formatted JVM option in [/etc/elasticsearch/jvm.options.d/heap.options] on line number [2]: [ -Xmx4g]
Nov 26 20:44:31 elastic systemd[1]: elasticsearch.service: Main process exited,