• java.lang.RuntimeException: can not run elasticsearch as root


    忘写了一个错误:

    [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:136) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.2.jar:5.6.2]
    Caused by: java.lang.RuntimeException: can not run elasticsearch as root
            at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
            at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]
            ... 6 more
    

     这个错误,是因为使用root用户启动elasticsearch,elasticsearch是不允许使用root用户启动的,所以我们需要添加用户。

    adduser ***   //添加用户

    passwd ***  //给用户赋值

    添加完用户之后:

    用root用户执行 : chown -R 文件夹名 用户名

    将这几个压缩包所在的文件夹及解压完的文件夹权限给你新建的用户。之后再使用新用户启动就OK了。

    参考链接:http://www.cnblogs.com/xd502djj/archive/2011/11/23/2260094.html

  • 相关阅读:
    树点涂色
    搜索+DP的一波小水题
    洛谷 P2194 HXY烧情侣
    洛谷 P3119 [USACO15JAN]草鉴定Grass Cownoisseur
    走楼梯升级版(9.8 模拟赛。。。xxy原创)
    洛谷 P2966 [USACO09DEC]牛收费路径Cow Toll Paths
    Tyvj P2207 上学路线route
    cogs 2342. [SCOI2007]kshort
    洛谷 P2740 [USACO4.2]草地排水Drainage Ditches
    洛谷 P1318 积水面积
  • 原文地址:https://www.cnblogs.com/yidiandhappy/p/7737003.html
Copyright © 2020-2023  润新知