安装
1 | 下载 |
确认是否启动
发送HTTP GET请求在9200端口1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20curl http://127.0.0.1:9200
{
"name" : "iZ2ze0fk8pd9zkdd29mpz6Z",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "-Jxq4rGVT_qJLnzJdnj75A",
"version" : {
"number" : "7.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
"build_date" : "2019-10-28T20:40:44.881551Z",
"build_snapshot" : false,
"lucene_version" : "8.2.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
报错及解决方法
1、内存不足1
2
3
4
5
6
7
8
9
10
11
12
13
14Exception 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 2060255232 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid29117.log
error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Not enough space' (errno=12)
at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:111)
at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:79)
at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:57)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:89)
修改 config目录的jvm.options文件,调小Xms的配置1
2
3
4
5
6
7
8# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
#-Xms2g
#-Xmx2g
-Xms512m
-Xmx512m
2、无法使用root用户启动1
2
3OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-11-05T19:57:15,328][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [iZ2ze0fk8pd9zkdd29mpz6Z] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
添加新用户1
2
3
4
5
6
7
8
9#添加用户es
useradd es
#修改elasticsearch目录使用者/群组
chown -R es:es /home/elasticsearch-7.4.2/
#切换用户到es
su es
#启动elasticsearch
./bin/elasticsearch