elastic5.4安装错误解决

发布时间:2017-7-1 11:13:09编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"elastic5.4安装错误解决 ",主要涉及到elastic5.4安装错误解决 方面的内容,对于elastic5.4安装错误解决 感兴趣的同学可以参考一下。

首先,我们从官网下载:
(官网:https://www.elastic.co/downloads/elasticsearch)(推荐下载deb或者rpm包,否则坑很多)

启动 (需要依赖java环境)

bin/elasticsearch

这时候会提示以下错误:

[2017-01-17T21:54:48,798][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] 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:125) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:82) ~[elasticsearch-5.1.2.jar:5.1.2]Caused by: java.lang.RuntimeException: can not run elasticsearch as root        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:100) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:176) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.2.jar:5.1.2]        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.2.jar:5.1.2]        ... 6 more

这个错误的原因是elasticsearch不允许使用root启动,因此我们要解决这个问题需要新建一个用户来启动elasticsearch

具体操作如下:

groupadd elsearchuseradd elsearch -g elsearch -p elsearchchmod -R 775 configchown -R elsearch:elsearch elasticsearch 

这个时候在这个用户去启动elasticsearch,发现可以启动,但是无法通过web - localhost:9200访问

修改config/elasticsearch.yml 文件

# ---------------------------------- Network -----------------------------------## Set the bind address to a specific IP (IPv4 or IPv6):#network.host: 192.168.0.155## Set a custom port for HTTP:#http.port: 9200## For more information, see the documentation at:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>

直接运行bin/elasticsearch文件启动elasticsearch,发现报错

max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

于是我临时提高了vm.max_map_count的大小 
*此操作需要root权限

sysctl -w vm.max_map_count=262144

查看修改结果

sysctl -a|grep vm.max_map_countvm.max_map_count = 262144

接下来就可以启动elasticsearch了,启动完成使用浏览器访问http://localhost:9200

{  "name" : "Vampire by Night",  "cluster_name" : "elasticsearch",  "version" : {    "number" : "5.0.0-alpha3",    "build_hash" : "cad959b",    "build_date" : "2016-05-26T08:25:57.564Z",    "build_snapshot" : false,    "lucene_version" : "6.0.0"  },  "tagline" : "You Know, for Search"}


上一篇:JAVA 中的堆和栈
下一篇:背水一战 Windows 10 (54) - 控件(集合类): ItemsControl 的布局控件 - OrientedVirtualizingPanel, VirtualizingStackPanel, WrapGrid

相关文章

相关评论

本站评论功能暂时取消,后续此功能例行通知。

一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!

二、互相尊重,对自己的言论和行为负责。

好贷网好贷款