无法启动Elasticsearch,无法创建Java虚拟机

v09wglhw  于 7个月前  发布在  ElasticSearch
关注(0)|答案(1)|浏览(109)

我正在运行Ubuntu 18.04.4 LTS,在Ruby 2.6.3上运行Ruby on Rails 6.0.3生产应用程序,使用elasticsearch 7.17。JVM在我到达之前就安装在系统上了。我相信它是在设置服务器之后安装的。
运行sudo systemctl start elasticsearch.service并失败。
运行systemctl status elasticsearch.service,它给了我:

● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2023-11-14 15:46:10 UTC; 936ms ago
     Docs: https://www.elastic.co
  Process: 13188 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
 Main PID: 13188 (code=exited, status=1/FAILURE)

Nov 14 15:46:10 appserver systemd-entrypoint[13188]: Error: Could not create the Java Virtual Machine.
Nov 14 15:46:10 appserver systemd-entrypoint[13188]: Error: A fatal exception has occurred. Program will exit.
Nov 14 15:46:10 appserver systemd-entrypoint[13188]:         at org.elasticsearch.tools.launchers.JvmOption.flagsFinal(JvmOption.java:119)
Nov 14 15:46:10 appserver systemd-entrypoint[13188]:         at org.elasticsearch.tools.launchers.JvmOption.findFinalOptions(JvmOption.java:81)
Nov 14 15:46:10 appserver systemd-entrypoint[13188]:         at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:38)
Nov 14 15:46:10 appserver systemd-entrypoint[13188]:         at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:135)
Nov 14 15:46:10 appserver systemd-entrypoint[13188]:         at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
Nov 14 15:46:10 appserver systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 15:46:10 appserver systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Nov 14 15:46:10 appserver systemd[1]: Failed to start Elasticsearch.

字符串
journalctl -xe给出:

-- Unit elasticsearch.service has begun starting up.
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: output:
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: error:
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: Unrecognized VM option 'UseConcMarkSweepGC'
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: Error: Could not create the Java Virtual Machine.
Nov 14 16:22:21 appserver systemd-entrypoint[16564]: Error: A fatal exception has occurred. Program will exit.
Nov 14 16:22:21 appserver systemd-entrypoint[16564]:         at org.elasticsearch.tools.launchers.JvmOption.flagsFinal(JvmOption.java:119)
Nov 14 16:22:21 appserver systemd-entrypoint[16564]:         at org.elasticsearch.tools.launchers.JvmOption.findFinalOptions(JvmOption.java:81)
Nov 14 16:22:21 appserver systemd-entrypoint[16564]:         at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:38)
Nov 14 16:22:21 appserver systemd-entrypoint[16564]:         at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:135)
Nov 14 16:22:21 appserver systemd-entrypoint[16564]:         at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
Nov 14 16:22:21 appserver systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 16:22:21 appserver systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Nov 14 16:22:21 appserver systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed


jvm.options文件:

################################################################
## IMPORTANT: JVM heap size
################################################################
##
-Xms8g
-Xmx8g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/heap-size.html
## for more information
##
################################################################

################################################################
## Expert settings
################################################################

## GC configuration
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-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
#14-:-XX:G1ReservePercent=25
#14-:-XX:InitiatingHeapOccupancyPercent=30

## 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/gc.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


我以前在Elasticsearch上遇到过很多问题,需要一些指导。

vshtjzan

vshtjzan1#

最后重新安装Elasticsearch,它现在可以工作了。
不知道什么问题是100%,但现在工作!

相关问题