经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Linux/Shell » 查看文章
elasticsearch启动常见问题
来源:cnblogs  作者:妖怪梧桐  时间:2019/7/30 9:30:30  对本文有异议

原文:https://blog.csdn.net/qq_22211217/article/details/80740873

一、Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ElasticsearchParseException[malformed, expected settings to start with 'object', instead was [VALUE_STRING]];
原因:elasticsearch.yml文件错误
解决:参数与参数值等号间需要空格

  1. node.name ="node" ##错误
  2. node.name = "node" ##正确

二、org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

详细错误:

  1. 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 a
  2. [2018-06-20T02:19:58,978][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
  3. org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
  4. at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.0.jar:6.3.0]
  5. at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.0.jar:6.3.0]
  6. at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
  7. at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
  8. at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
  9. at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.0.jar:6.3.0]
  10. at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
  11. Caused by: java.lang.RuntimeException: can not run elasticsearch as root
  12. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.3.0.jar:6.3.0]
  13. at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) ~[elasticsearch-6.3.0.jar:6.3.0]
  14. at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.0.jar:6.3.0]
  15. at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.0.jar:6.3.0]
  16. ... 6 more

原因:处于对root用户的安全保护,需要使用其他用户组进行授权启动
解决:
step1:用户组进行授权启动

  1. groupadd elsearch
  2. useradd elsearch -g elsearch -p elasticsearch
  3. chown -R elsearch:elsearch elasticsearch-6.3.0
  4. 备注: 添加用户组 elsearch
  5. 添加用户 elsearch 密码为 elasticsearch 到用户组 elsearch
  6. elsearch安装目录授权给 用户组:用户 elsearchelsearch

step2: 重新启动

  1. su elsearch
  2. /elasticsearch-6.3.0/bin/elasticsearch
  3. 备注:切换 elsearch 用户
  4. 重新启动

三、OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot a ...'(errno=12);
原因:jvm要分配最大内存超出系统内存
解决:

step1:适当调整指定jvm内存
  1. vi /home/elasticsearch-6.3.0/config/jvm.options
  2. 备注:编辑elasticsearch jvm配置文件 修改如下 esc+:wq保存退出
  1. ## JVM configuration
  2. ################################################################
  3. ## IMPORTANT: JVM heap size
  4. ################################################################
  5. ##
  6. ## You should always set the min and max JVM heap
  7. ## size to the same value. For example, to set
  8. ## the heap to 4 GB, set:
  9. ##
  10. ## -Xms4g
  11. ## -Xmx4g
  12. ##
  13. ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
  14. ## for more information
  15. ##
  16. ################################################################
  17. # Xms represents the initial size of total heap space
  18. # Xmx represents the maximum size of total heap space
  19. -Xms512m
  20. -Xmx512m
  1. 备注:由于虚拟机内存制定1g,所以适当降低jvm内存指定
step2:重启
  1. su elsearch
  2. /elasticsearch-6.3.0/bin/elasticsearch

四、ERROR: [3] bootstrap checks failed

详细错误:

  1. [2018-06-20T02:35:47,152][INFO ][o.e.b.BootstrapChecks ] [SUcoFrg] bound or publishing to a non-loopback address, enforcing bootstrap checks
  2. ERROR: [3] bootstrap checks failed
  3. [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
  4. [2]: max number of threads [3802] for user [elsearch] is too low, increase to at least [4096]
  5. [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  6. [2018-06-20T02:35:47,170][INFO ][o.e.n.Node ] [SUcoFrg] stopping ...
  7. [2018-06-20T02:35:47,316][INFO ][o.e.n.Node ] [SUcoFrg] stopped
  8. [2018-06-20T02:35:47,316][INFO ][o.e.n.Node ] [SUcoFrg] closing ...
  9. [2018-06-20T02:35:47,336][INFO ][o.e.n.Node ] [SUcoFrg] closed

原因:虚拟机限制用户的执行内存
解决:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3802] for user [elsearch] is too low, increase to at least [4096]

step1:修改安全限制配置文件

  1. su root
  2. vi /etc/security/limits.conf
  3. 备注:使用最高权限 修改安全配置 在文件末尾加入
  4. # End of file
  5. elsearch hard nofile 65536
  6. elsearch soft nofile 65536
  7. * soft nproc 4096
  8. * hard nproc 4096
  9. 备注: elsearch为用户名 可以是使用*进行通配
  10. nofile 最大打开文件数目
  11. nproc 最大打开线程数目

 

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

step2:修改系统配置文件
  1. vi /etc/sysctl.conf
  1. 备注:行末加上vm.max_map_count = 655360 ,esc +:wq保存退出
  1. # sysctl settings are defined through files in
  2. # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
  3. #
  4. # Vendors settings live in /usr/lib/sysctl.d/.
  5. # To override a whole file, create a new file with the same in
  6. # /etc/sysctl.d/ and put new settings there. To override
  7. # only specific settings, add a file with a lexically later
  8. # name in /etc/sysctl.d/ and put new settings there.
  9. #
  10. # For more information, see sysctl.conf(5) and sysctl.d(5).
  11. vm.max_map_count = 655360
  1. 备注:vm.max_map_count = 655360 值大于错误提示值
step3:重启
  1. su elsearch
  2. /elasticsearch-6.3.0/bin/elasticsearch

五、org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/home/elasticsearch-6.3.0/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

详细报错:
  1. [2018-06-20T04:23:25,003][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
  2. org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/home/elasticsearch-6.3.0/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
  3. at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.0.jar:6.3.0]
  4. at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.0.jar:6.3.0]
  5. at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
  6. at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
  7. at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
  8. at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.0.jar:6.3.0]
  9. at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
  10. Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/home/elasticsearch-6.3.0/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
  11. at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:243) ~[elasticsearch-6.3.0.jar:6.3.0]
  12. at org.elasticsearch.node.Node.<init>(Node.java:270) ~[elasticsearch-6.3.0.jar:6.3.0]
  13. at org.elasticsearch.node.Node.<init>(Node.java:252) ~[elasticsearch-6.3.0.jar:6.3.0]
  14. at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.3.0.jar:6.3.0]
  15. at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.0.jar:6.3.0]
  16. at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.0.jar:6.3.0]
  17. at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.0.jar:6.3.0]
  18. ... 6 more

原因:线程占用

解决:重新启动

step1:杀死elasticsearch线程
  1. ps -ef | grep elastic
step2: 重启
  1. su elsearch
  2. /elasticsearch-6.3.0/bin/elasticsearch

原文:https://blog.csdn.net/qq_22211217/article/details/80740873

 




 

原文链接:http://www.cnblogs.com/sitongyan/p/11263753.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号