elasticsearch启动常见错误

本文详细介绍了在CentOS 7环境下,针对Elasticsearch 7.13版本遇到的六个问题及其解决方案。包括maxfiledescriptors、maxnumberofthreads、vm.max_map_count设置过低,权限不足,以及集群配置不完整等问题,提供了修改系统配置文件如limits.conf和sysctl.conf,以及调整文件权限和配置文件elasticsearch.yml的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文链接:https://www.cnblogs.com/zhi-leaf/p/8484337.html

问题出现环境,OS版本:CentOS-7-x86_64;ES版本:elasticsearch-7.13

Q1:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

  1. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

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

    ulimit -Hn
    ulimit -Sn
    

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

    *               soft    nofile          65536
    *               hard    nofile          65536
    

Q2:max number of threads [3818] for user [es] is too low, increase to at least [4096]

  1. max number of threads [3818] for user [es] is too low, increase to at least [4096]

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

    	*               soft    nproc           4096
    	*               hard    nproc           4096
    

    可通过命令查看

    	ulimit -Hu
    	ulimit -Su
    

    修改后的文件:

    *               soft    nofile          65536
    *               hard    nofile          65536
    *               soft    nproc           4096
    *               hard    nproc           4096
    

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

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

    修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144

    vi /etc/sysctl.conf
    sysctl -p
    

    执行命令sysctl -p生效

Q4:Exception in thread “main” java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-7.13/config/jvm.options

  1. Exception in thread “main” java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-7.13/config/jvm.options

    elasticsearch用户没有该文件夹的权限,执行命令

    chown -R es:es /usr/local/elasticsearch/

Q5: 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

原文链接: https://blog.youkuaiyun.com/qq_43655835/article/details/104637625

在elasticsearch的config目录下,修改elasticsearch.yml配置文件,将下面的配置加入到该配置文件中:

ip替换host1等,多节点请添加多个ip地址,单节点可写按默认来
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值

在这里插入图片描述

Q6:es集群启动完成后浏览器输入/_cat/nodes?pretty报master_not_discovered_exception

原文链接:https://yanglinwei.blog.youkuaiyun.com/article/details/105274464

es集群启动后,在浏览器输入:http://es ip地址:端口/_cat/nodes?pretty,会提示如下错误:
{ "error" : { "root_cause" : [ { "type" : "master_not_discovered_exception", "reason" : null } ], "type" : "master_not_discovered_exception", "reason" : null }, "status" : 503 }

解决方案:
在每个配置文件指定初始节点:

cluster.initial_master_nodes: node-1

在这里插入图片描述
重启ES集群,浏览器再次输入http://es ip地址:端口/_cat/nodes?pretty,就可以看到集群启动成功了:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值