启动 Elasticsearch 报错 bootstrap checks failed 解决

文章
林里克斯

Elasticsearch 是一个基于 Lucene 的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于 RESTful web 接口。Elasticsearch 是用 Java 语言开发的,并作为 Apache 许可条款下的开放源码发布,是一种流行的企业级搜索引擎。

实验平台:CentOS 7.7.1908

Elasticsearch Version: 7.5.1

Java Version: OpenJDK 13.0.1


启动 Elasticsearch 报错 bootstrap checks failed 解决


1.报错信息

启动 Elasticsearch 报错 bootstrap checks failed 解决

ERROR: [5] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: max number of threads [2048] for user [tongtech] is too low, increase to at least [4096]
[4]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[5]:memory locking requested for elasticsearch process but memory is not locked
[6]: initial heap size [2147483648] not equal to maximum heap size [32210157568]; this can cause resize pauses and prevents mlockall from locking the entire heap

2.解决报错

  • 报错 [1]
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
#最大文件描述符 [4096] 较小,调整至最低 [65535]

编辑 /etc/security/limits.conf 填加以下内容

$ vim /etc/security/limits.conf

* soft nofile 65536
* hard nofile 65536
#此文件修改后需要重开窗口,如果只直接在物理机上操作需重启物理机。
  • 报错[2]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
#最大虚拟内存 [65530] 较小,调整至最低 [262144]

编辑 /etc/sysctl.conf 添加以下内容:

$ vim /etc/sysctl.conf
vm.max_map_count=262144

保存后,需执行一下内容生效:

$ sysctl -p
  • 报错 [3]
[3]: max number of threads [2048] for user [tongtech] is too low, increase to at least [4096]
#最大线程数 [2048] 较小,调整至最低 [4096]

编辑 /etc/security/limits.d/20-nproc.conf

$ vim /etc/security/limits.d/20-nproc.conf  (前面数字可能不一致)

 *          soft    nproc     2048
#将 2048 改为 4096 或更大
  • 报错[4]
[4]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
# elasticsearch.yml 不适用于生产环境

编辑配置文件 elasticsearch.yml

$ vim /data/elasticsearch/config/elasticsearch.yml

discovery.seed_hosts: ["192.168.50.151","192.168.50.152","192.168.50.150"]
cluster.initial_master_nodes: ["192.168.50.151","192.168.50.152","192.168.50.150"]
  • 报错[5]
[5]:memory locking requested for elasticsearch process but memory is not locked

elasticsearch 官网建议生产环境需要设置 bootstrap.memory_lock: true ,也可以使用以下配置解决报错。

$ vim /etc/security/limits.conf
user soft memlock unlimited
user hard memlock unlimited
#user 为启动 elasticsearch 的用户
  • 报错[6]

elasticsearch jvm 内存分配不够导致,调整一下值重启即可

$ vim /data/elasticsearch/config/jvm.options

-Xms16g
-Xmx16g

elasticsearch 集群启动出现 failed to send join request to master

具体报错如下

[node-2] failed to send join request to master [{node-1}{10.10.10.131}{10.10.10.130:9300}], reason [RemoteTransportException[[node-1][10.10.10.131:9300][internal:discovery/data/]]; nested: IllegalArgumentException[can't add node {node-2}{10.10.10.130}{10.10.10.131:9301}, found existing node {node-1}{10.10.10.130}{10.10.11.131:9300} with the same id but is a different node instance]; ]

具体原因是因为我把 node-1 误删了,将另一台机器上的 node-2 拷贝过来改了配置文件启动

解决这个问题将 /data/elasticsearch/data/ 下的数据删除掉后重新启动就可以了。再次警示删除操作一定要 谨慎!谨慎!谨慎!


Over~

版权协议须知!

本篇文章来源于 Uambiguous ,如本文章侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意

820 0 2020-10-28


分享:
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif
博主卡片
林里克斯 博主大人
一个致力于Linux的运维平台
运维时间
搭建这个平台,只为分享及记载自己所遇之事和难题。

现在时间 2024-04-27

今日天气
站点统计
  • 文章总数:240篇
  • 分类总数:29个
  • 评论总数:10条
  • 本站总访问量 216231 次

@奥奥

@Wong arrhenius 牛比

@MakerFace 厉害了!