elasticsearch启动常见错误

root用户启动es 出现如下错误

[root@bigdata124 ~]# cd /opt/module/elasticsearch-5.6.2/
[root@bigdata124 elasticsearch-5.6.2]# ./bin/elasticsearch
[2019-11-21T18:02:25,703][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [bigdata124] 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@bigdata124 elasticsearch-5.6.2]# su felix      // felix 是提前创建好的用户
[felix@bigdata124 elasticsearch-5.6.2]$ ./bin/elasticsearch
[2019-11-21T18:02:46,107][INFO ][o.e.n.Node               ] [bigdata124] initializing ...
[2019-11-21T18:02:46,172][INFO ][o.e.e.NodeEnvironment    ] [bigdata124] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [35gb], net total_space [37.4gb], spins? [unknown], types [rootfs]
[2019-11-21T18:02:46,173][INFO ][o.e.e.NodeEnvironment    ] [bigdata124] heap size [1.9gb], compressed ordinary object pointers [true]
[2019-11-21T18:02:46,173][INFO ][o.e.n.Node               ] [bigdata124] node name [bigdata124], node ID [nTz4Fb7tQsqj-6pwsIp0rQ]
[2019-11-21T18:02:46,174][INFO ][o.e.n.Node               ] [bigdata124] version[5.6.2], pid[2611], build[57e20f3/2017-09-23T13:16:45.703Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
[2019-11-21T18:02:46,174][INFO ][o.e.n.Node               ] [bigdata124] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/module/elasticsearch-5.6.2]
[2019-11-21T18:02:46,883][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [aggs-matrix-stats]
[2019-11-21T18:02:46,883][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [ingest-common]
[2019-11-21T18:02:46,883][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-expression]
[2019-11-21T18:02:46,884][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-groovy]
[2019-11-21T18:02:46,884][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-mustache]
[2019-11-21T18:02:46,884][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-painless]
[2019-11-21T18:02:46,884][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [parent-join]
[2019-11-21T18:02:46,885][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [percolator]
[2019-11-21T18:02:46,885][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [reindex]
[2019-11-21T18:02:46,885][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [transport-netty3]
[2019-11-21T18:02:46,885][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [transport-netty4]
[2019-11-21T18:02:46,887][INFO ][o.e.p.PluginsService     ] [bigdata124] no plugins loaded
[2019-11-21T18:02:48,268][INFO ][o.e.d.DiscoveryModule    ] [bigdata124] using discovery type [zen]
[2019-11-21T18:02:48,568][INFO ][o.e.n.Node               ] [bigdata124] initialized
[2019-11-21T18:02:48,568][INFO ][o.e.n.Node               ] [bigdata124] starting ...
[2019-11-21T18:02:48,662][INFO ][o.e.t.TransportService   ] [bigdata124] publish_address {192.168.1.124:9300}, bound_addresses {192.168.1.124:9300}
[2019-11-21T18:02:48,667][INFO ][o.e.b.BootstrapChecks    ] [bigdata124] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

[2]:max number of threads [3818] for user [es] is too low, increase to at least [4096]
[2019-11-21T18:02:48,674][INFO ][o.e.n.Node               ] [bigdata124] stopping ...
[2019-11-21T18:02:48,775][INFO ][o.e.n.Node               ] [bigdata124] stopped
[2019-11-21T18:02:48,775][INFO ][o.e.n.Node               ] [bigdata124] closing ...
[2019-11-21T18:02:48,786][INFO ][o.e.n.Node               ] [bigdata124] closed

 

[1] 的解决办法

每个进程最大同时打开文件数太小,可通过下面2个命令查看当前数量

ulimit -Hn
ulimit -Sn

修改/etc/security/limits.conf文件,增加配置,用户退出后重新登录生效

*               soft    nofile          65536
*               hard    nofile          65536

再次查看问题解决

[2] 的解决办法

问题同上,最大线程个数太低。修改配置文件/etc/security/limits.conf(和问题1是一个文件),增加配置

*               soft    nproc           4096
*               hard    nproc           4096

[root@bigdata124 ~]# vi /etc/sysctl.conf
[root@bigdata124 ~]# sysctl -p
vm.max_map_count = 262144
 

再次启动问题解决:

[felix@bigdata124 elasticsearch-5.6.2]$ ./bin/elasticsearch
[2019-11-21T18:17:22,798][INFO ][o.e.n.Node               ] [bigdata124] initializing ...
[2019-11-21T18:17:22,866][INFO ][o.e.e.NodeEnvironment    ] [bigdata124] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [35gb], net total_space [37.4gb], spins? [unknown], types [rootfs]
[2019-11-21T18:17:22,867][INFO ][o.e.e.NodeEnvironment    ] [bigdata124] heap size [1.9gb], compressed ordinary object pointers [true]
[2019-11-21T18:17:22,867][INFO ][o.e.n.Node               ] [bigdata124] node name [bigdata124], node ID [nTz4Fb7tQsqj-6pwsIp0rQ]
[2019-11-21T18:17:22,867][INFO ][o.e.n.Node               ] [bigdata124] version[5.6.2], pid[2793], build[57e20f3/2017-09-23T13:16:45.703Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01]
[2019-11-21T18:17:22,868][INFO ][o.e.n.Node               ] [bigdata124] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/module/elasticsearch-5.6.2]
[2019-11-21T18:17:23,801][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [aggs-matrix-stats]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [ingest-common]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-expression]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-groovy]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-mustache]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [lang-painless]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [parent-join]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [percolator]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [reindex]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [transport-netty3]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] loaded module [transport-netty4]
[2019-11-21T18:17:23,802][INFO ][o.e.p.PluginsService     ] [bigdata124] no plugins loaded
[2019-11-21T18:17:25,221][INFO ][o.e.d.DiscoveryModule    ] [bigdata124] using discovery type [zen]
[2019-11-21T18:17:25,485][INFO ][o.e.n.Node               ] [bigdata124] initialized
[2019-11-21T18:17:25,485][INFO ][o.e.n.Node               ] [bigdata124] starting ...
[2019-11-21T18:17:25,795][INFO ][o.e.t.TransportService   ] [bigdata124] publish_address {192.168.1.124:9300}, bound_addresses {192.168.1.124:9300}
[2019-11-21T18:17:25,802][INFO ][o.e.b.BootstrapChecks    ] [bigdata124] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2019-11-21T18:17:28,864][INFO ][o.e.c.s.ClusterService   ] [bigdata124] new_master {bigdata124}{nTz4Fb7tQsqj-6pwsIp0rQ}{lBH8WiEeTbq2-MgF7X85tw}{bigdata124}{192.168.1.124:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2019-11-21T18:17:28,882][INFO ][o.e.h.n.Netty4HttpServerTransport] [bigdata124] publish_address {192.168.1.124:9200}, bound_addresses {192.168.1.124:9200}
[2019-11-21T18:17:28,882][INFO ][o.e.n.Node               ] [bigdata124] started
[2019-11-21T18:17:28,889][INFO ][o.e.g.GatewayService     ] [bigdata124] recovered [0] indices into cluster_state
 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值