安装elasticsearch的时候运行./elasticsearch报错
解决办法参考:CENTOS安装ElasticSearch https://my.oschina.net/topeagle/blog/591451
[root@ELK 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:21:54,647][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.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.4.0.jar:5.4.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.4.0.jar:5.4.0]
... 6 more
提示报错:java.lang.RuntimeException: can not run elasticsearch as root
将elasticsearch所在的文件夹所属用户和组都改为admin,切换到admin再启动
- 创建elsearch用户组及elsearch用户
cd /usr/local
chown -R admin:admin elasticsearch
切换到admin用户再运行
[admin@ELK 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}