天天看點

can not run elasticsearch as root at org.elasticsearch.boots

安裝elasticsearch的時候運作./elasticsearch報錯

解決辦法參考:CENTOS安裝ElasticSearch https://my.oschina.net/topeagle/blog/591451

[[email protected] bin]# ./elasticsearch
OpenJDK -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
[--T05::,][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:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.cli.Command.main(Command.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:) ~[elasticsearch-.jar:]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:) ~[elasticsearch-.jar:]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:) ~[elasticsearch-.jar:]
    ...  more
           

提示報錯:java.lang.RuntimeException: can not run elasticsearch as root

将elasticsearch所在的檔案夾所屬使用者群組都改為admin,切換到admin再啟動

  • 建立elsearch使用者組及elsearch使用者
cd /usr/local
chown -R admin:admin elasticsearch
           

切換到admin使用者再運作

[[email protected] bin]$ ./elasticsearch
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
[2017-05-25T05:25:38,824][INFO ][o.e.n.Node               ] [] initializing ...
[2017-05-25T05:25:38,989][INFO ][o.e.e.NodeEnvironment    ] [cUN3nln] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [23.1gb], net total_space [27.7gb], spins? [unknown], types [rootfs]
[2017-05-25T05:25:38,989][INFO ][o.e.e.NodeEnvironment    ] [cUN3nln] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-05-25T05:25:38,991][INFO ][o.e.n.Node               ] node name [cUN3nln] derived from node ID [cUN3nlnKQAmkk-YEP-v9uQ]; set [node.name] to override
[2017-05-25T05:25:38,992][INFO ][o.e.n.Node               ] version[5.4.0], pid[19619], build[780f8c4/2017-04-28T17:43:27.229Z], OS[Linux/3.10.0-514.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_131/25.131-b11]
[2017-05-25T05:25:41,049][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [aggs-matrix-stats]
[2017-05-25T05:25:41,049][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [ingest-common]
[2017-05-25T05:25:41,049][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [lang-expression]
[2017-05-25T05:25:41,049][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [lang-groovy]
[2017-05-25T05:25:41,049][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [lang-mustache]
[2017-05-25T05:25:41,050][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [lang-painless]
[2017-05-25T05:25:41,050][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [percolator]
[2017-05-25T05:25:41,050][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [reindex]
[2017-05-25T05:25:41,050][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [transport-netty3]
[2017-05-25T05:25:41,050][INFO ][o.e.p.PluginsService     ] [cUN3nln] loaded module [transport-netty4]
[2017-05-25T05:25:41,051][INFO ][o.e.p.PluginsService     ] [cUN3nln] no plugins loaded
[2017-05-25T05:25:44,144][INFO ][o.e.d.DiscoveryModule    ] [cUN3nln] using discovery type [zen]
[2017-05-25T05:25:45,204][INFO ][o.e.n.Node               ] initialized
[2017-05-25T05:25:45,204][INFO ][o.e.n.Node               ] [cUN3nln] starting ...
[2017-05-25T05:25:45,501][INFO ][o.e.t.TransportService   ] [cUN3nln] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
           

繼續閱讀