跳过正文
  1. Posts/

elasticsearch启动常见错误

·233 字·2 分钟·
Kubehan
作者
Kubehan
云原生知识栈:深度解析容器技术、Kubernetes、Istio、DevOps 实践、Prometheus 监控、Envoy 代理、Golang 开发及云原生架构与微服务趋势的专业博客

问题出现环境,OS版本:CentOS-7-x86_64-Minimal-1708;ES版本:elasticsearch-6.2.2。

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

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

<span style="color: black; font-family: Courier New; font-size: 16pt; background-color: whitesmoke;">ulimit -Hn<br /> </span>

<span style="font-family: Courier New; font-size: 14pt;"><span style="color: black; background-color: whitesmoke;">ulimit -Sn</span></span>

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

<span style="color: black; font-family: Courier New; font-size: 16pt; background-color: whitesmoke;">*  soft    nofile          65536
</span>

<span style="font-family: Courier New; font-size: 16pt;"><span style="color: black; background-color: whitesmoke;">*  hard    nofile          65536</span></span>


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

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

1

    <p style="text-align: right; background: white;">
      <span style="color: #afafaf; font-family: Consolas; font-size: 7pt;">2</span>
    </p>
  </td>
  
  <td style="border-top: solid silver 0.5pt; border-left: none; border-bottom: solid silver 0.5pt; border-right: solid silver 0.5pt; padding: 3px;">
    <p style="background: #f4f4f4;">
      <span style="font-family: Consolas; font-size: 7pt;"><span style="color: black;">*               soft    nproc           4096</span><br /> </span>
    </p>
    
    <p style="background: white;">
      <span style="color: black; font-family: Consolas; font-size: 7pt;">*               hard    nproc           4096</span>
    </p>
  </td>
</tr>

  可通过命令查看

<span style="color: black; font-family: Courier New; font-size: 16pt; background-color: whitesmoke;">ulimit -Hu
</span>

<span style="font-family: Courier New; font-size: 16pt;"><span style="color: black; background-color: whitesmoke;">ulimit -Su</span></span>


3、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

<span style="font-family: Courier New;"><span style="color: black;"><span style="font-size: 16pt; background-color: whitesmoke;">vi /etc/sysctl.conf</span><span style="font-size: 7pt; background-color: whitesmoke;">
</span><span style="font-size: 14pt; background-color: whitesmoke;">sysctl -p</span></span></span>

  执行命令sysctl -p生效


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

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

<span style="font-family: Courier New; font-size: 14pt;"><span style="color: black; background-color: whitesmoke;">chown -R es:es /usr/local/elasticsearch/</span>				</span>