[root@nanzx /]# cd /opt/es/ [root@nanzx es]# su es [es@nanzx es]$ bin/elasticsearch # 后台启动 [es@nanzx es]$ bin/elasticsearch -d
启动异常问题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@nanzx es]# bin/elasticsearch Exception in thread "main" java.lang.RuntimeException: starting java failed with [1] output: # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory. # An error report file with more information is saved as: # logs/hs_err_pid95986.log error: OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Not enough space' (errno=12) at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:126) at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:88) at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:59) at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:137) at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:95)
[root@nanzx es]# bin/elasticsearch [2021-11-21T13:25:57,949][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.8.0.jar:7.8.0] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.8.0.jar:7.8.0]
解决方法:
切换为elasticsearch文件夹所有者登录(参考第二步创建的用户):su es
1 2 3 4
[es@nanzx es]$ bin/elasticsearch could not find java in bundled jdk at /root/software/es/jdk/bin/java [es@nanzx es]$ java -version bash: java: 未找到命令
说明 es 没有此目录的权限,需要把Elasticsearch文件夹复制到非root目录里,建议软件不要直接安装在root目录下
1 2 3 4 5
[es@nanzx es]$ bin/elasticsearch future versions of Elasticsearch will require Java 11; your Java version from [/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre] does not meet this requirement future versions of Elasticsearch will require Java 11; your Java version from [/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre] does not meet this requirement OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N 已杀死