elastic search 第一次安装 报错记录
Posted uzai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elastic search 第一次安装 报错记录相关的知识,希望对你有一定的参考价值。
安装版本 elasticsearch-5.5.2
安装路径 /usr/local/es/
启动报错:
/usr/local/es/elasticsearch-5.5.2/bin/
bash ./bash ./elasticsearch
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=‘Cannot allocate memory‘ (errno=12) # # 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: # /usr/local/es/elasticsearch-5.5.2/bin/hs_err_pid2353.log
解决:
切换到配置目录下 /usr/local/es/elasticsearch-5.5.2/config/
打开 jvm.options
将 -Xms2g 改为1g (改1g不行就试试 改成 512m)
再次启动试一试吧。
报错:
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.2.jar:5.5.2] Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.2.jar:5.5.2] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.2.jar:5.5.2]
意思是不能用root用户来启动,那我们新建一个用户来启动
继续解决这个问题
## 意思是不能用root用户来启动,那我们新建一个用户来启动 [root@VM_0_13_centos bin]# useradd elastic ##新建elastic用户 并且把目录权限赋予给elastic [root@VM_0_13_centos bin]# chown -R elastic:elastic /usr/local/es/elasticsearch-5.5.2/ ##我们切换成elastic用户,然后执行 [root@VM_0_13_centos bin]# su elastic [elastic@VM_0_13_centos bin]$ sh /usr/local/es/elasticsearch-5.5.2/bin/elasticsearch
## -d 后台运行 [elastic@VM_0_13_centos bin]$ sh /usr/local/es/elasticsearch-5.5.2/bin/elasticsearch -d ## 检查是否启动成功 [elastic@VM_0_13_centos bin]$ ps -ef | grep elasticsearch
若出现这个表示成功
我们来验证下服务是否正常运行 curl http://localhost:9200
"name" : "QHNWXbg", "cluster_name" : "elasticsearch", "cluster_uuid" : "hVyq1z2LR9aEiyBhEsU-fw", "version" : "number" : "5.5.2", "build_hash" : "b2f0c09", "build_date" : "2017-08-14T12:33:14.154Z", "build_snapshot" : false, "lucene_version" : "6.6.0" , "tagline" : "You Know, for Search"
感谢:
java1234 小锋
https://m.aliyun.com/yunqi/articles/523874
以上是关于elastic search 第一次安装 报错记录的主要内容,如果未能解决你的问题,请参考以下文章
elastic search报错——“failed to obtain node locks”
教你用Elastic Search:运行第一条Hello World搜索命令
AWS Firehose 到 Elastic Search - 将一条 Firehose 记录转换为多个 Elastic 条目