大漠知秋的加油站

  • 首页
大漠知秋的加油站
你就当我的烂笔头吧
  1. 首页
  2. Elasticsearch
  3. 正文

问题 - Elasticsearch 问题收集

2019年1月3日 1375点热度 0人点赞 0条评论

  此篇记录在使用 Elasticsearch 过程中遇到的问题

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

  这是由于 Elasticsearch 处于安全考虑,不予许使用超级管理员 root 进行启动,只需建立一个 Elasticsearch 使用的用户即可

# 添加用户
[root@elasticsearch-1 ~]# adduser es
# 设置密码
[root@elasticsearch-1 ~]# passwd es
# 切换用户启动 Elasticsearch
[root@elasticsearch-1 ~]# su es
[es@elasticsearch-1 root]$
  • Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch-6.4.0/config/jvm.options

  再上一个问题新建 es 用户之后,切换到 es 用户启动出现此错,原因是此用户没有 Elasticsearch 安装目录的权限,这里还需要切换回 root 用户给与 es 用户权限才可。

[es@elasticsearch-1 root]$ exit
exit
[root@elasticsearch-1 ~]# chown -R es /usr/local/elasticsearch-6.4.0/
[root@elasticsearch-1 ~]# su es
  • 外部网络访问

  Elasticsearch 默认只能进行本地访问,如果想进行外网访问,可以更改配置文件 $ES_HOME/config/elasticsearch.yml 中的参数 network.host 为 0.0.0.0 即可。

  • max virtual memory areas vm.maxmapcount [65530] is too low

  最大虚拟内存过低,使用 root 权限更改即可。

[es@elasticsearch-1 elasticsearch-6.4.0]$ sudo sysctl -w vm.max_map_count=262144

### 让配置永久生效,使用 root 权限
vim /etc/sysctl.conf
# 在文末添加以下内容:
vm.max_map_count=262144
  • max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] 和 max number of threads [1024] for user [es] is too low, increase to at least [4096]
[root@elasticsearch-1 ~]# vim /etc/security/limits.conf  

# 在文件未添加以下内容(开头 es 为用户名,“*”为全部)
es soft nofile 65536
es hard nofile 131072
es soft nproc 4096
es hard nproc 4096
  • system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

  Centos 6 不支持 SecComp,而 ES6 默认 bootstrap.sys temcall_filter 为 true

[es@elasticsearch-1 elasticsearch-6.4.0]$ vim config/elasticsearch.yml  

  在 elasticsearch.yml 中配置 bootstrap.system_call_filter 为 false,但是默认是没有这个配置项的,所以。。。注意要在 Memory 下面:

  取消 bootstrap.memory_lock 的注释,添加 bootstrap.system_call_filter 配置

bootstrap.memory_lock: false
bootstrap.system_call_filter: false  
标签: Elasticsearch ERROR 问题
最后更新:2019年1月3日

大漠知秋

唯黄昏而思烛明,唯覆雪始念日暖,唯放手方知情真,今困苦而怀峥嵘,今飘零而涌乡愁,今孑然而徒唏嘘,唏嘘成愁。

点赞
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2023 大漠知秋的加油站. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备16029200号-2