您现在的位置是:网站首页>>数据库>>elasticsearch

启动elasticsearch失败常见错误

发布时间:2018-11-28 15:03:55作者:wangjian浏览量:737点赞量:0

    一:使用root用户启动elasticsearch

    [2018-11-28T15:05:52,172][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:127) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]

    Caused by: java.lang.RuntimeException: can not run elasticsearch as root

    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]

    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]

    ... 6 more

    解决

    使用elasticsearch用户去启动elasticsearch

    二:日志和数据目录权限异常,启动失败

    2018-11-28 15:10:59,843 main ERROR RollingFileManager (/usr/local/elasticsearch/logs/elasticsearch_index_indexing_slowlog.log) java.io.FileNotFoundException: /usr/local/elasticsearch/logs/elasticsearch_index_indexing_slowlog.log (权限不够) java.io.FileNotFoundException: /usr/local/elasticsearch/logs/elasticsearch_index_indexing_slowlog.log (权限不够)......

    解决:

    修改elasticsearch/logs和elasticsearch/data目录权限

    chown -R elasticsearch:elasticsearch /usr/local/elasticsearch

    三:内存不够

    max file descriptors.......

    解决:

    修改/etc/security/limits.conf,添加或者修改如下(切换root用户)

    *  hard  nofile  65536
    *  soft   nofile  65536

    四:elasticsearch用户拥有的内存权限太小

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

    解决:

    修改/etc/sysctl.conf 添加

    vm.max_map_count=2621441

    保存后执行

    sudo sysctl -p /etc/sysctl.conf

     使之生效

    五:

    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

    解决:

    在虚拟机的设置中,将处理器的处理器核心数量改成2,重新执行启动命令后,能够正常运行。若还是未能执行成功,可进一步将处理器数量也改成2

    image.png



0 +1