voxpupuli / puppet-elasticsearch

Elasticsearch Puppet module
Apache License 2.0
404 stars 479 forks source link

File jvm.options in root is unmanaged/may be missing #1197

Closed bmagistro closed 4 months ago

bmagistro commented 12 months ago

This effectively re-opens #928 and relates to #1041.

When migrating from the multi instance to single instance of elasticsearch, the jvm.options file may not exist and is not created by the module. This results in elasticsearch being unable to start. As pointed out in #928 the file may be empty but does need to exist. The manual work around is to touch /etc/elasticsearch/jvm.options so the file does exist and allows the service to start. I am willing to guess the file is indeed present in the default install and that is why this doesn't trigger an issue more often.

from /var/log/messages

Jul  9 12:22:44 es-0001 systemd: Starting Elasticsearch...
Jul  9 12:22:45 es-0001 systemd-entrypoint: Exception in thread "main" java.nio.file.NoSuchFileException: /etc/elasticsearch/jvm.options
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at java.base/java.nio.file.Files.newInputStream(Files.java:160)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at org.elasticsearch.tools.launchers.JvmOptionsParser.readJvmOptionsFiles(JvmOptionsParser.java:168)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:124)
Jul  9 12:22:45 es-0001 systemd-entrypoint: at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
Jul  9 12:22:46 es-0001 systemd: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Jul  9 12:22:46 es-0001 systemd: Failed to start Elasticsearch.
Jul  9 12:22:46 es-0001 systemd: Unit elasticsearch.service entered failed state.
Jul  9 12:22:46 es-0001 systemd: elasticsearch.service failed.