ElasticSearch环境搭建遇到的问题及解决方法

以下问题都是作者亲身踩过的坑,希望对小伙伴有帮助^_^

问题一:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

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

    vi /etc/security/limits.conf

    #es 是用户名
    es  hard    nofile  65536
    es  soft    nofile  65536

    #重新登录 yellowcong 账户,查看是否生效
    su yellowcong

    #查看配置是否生效
    ulimit -Hn

2.max virtual memory areas vm.max......

    #修改sysctl配置
    vi /etc/sysctl.conf

    #添加如下配置
    vm.max_map_count=262144

    #让配置生效
    sysctl -p

    #查看配置的数目
    sysctl -a|grep vm.max_map_count

如果仍然不生效,重启

问题二:
JNA Warning: IOException removing temporary files: JNA temporary directory '/home/yutao/tmp/elasticsearch' is not writable
[2017-12-02T17:54:50,683][WARN ][o.e.b.Natives            ] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library:
JNA temporary directory '/home/yutao/tmp/elasticsearch' is not writable

解决方法:
 vim jvm.options
 # 上面省略。。。
 # 在最后添加
 -Djava.io.tmpdir=/home/yutao/tmp/elasticsearch
 -Djna.tmpdir=/home/yutao/tmp/elasticsearch

问题三:

聚合的时候会有问题 nested: CircuitBreakingException[[request] Data too large, data for [<agg [data_result]>] would be [622780448/593.9mb],
which is larger than the limit of [622775500/593.9mb]]; }

解决方法:
 在elasticsearch.yml中配置indices.fielddata.cache.size: 5GB ,调大fielddata的大小

问题四:

java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed

原因:  因为Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动解决
解决方法:

  修改elasticsearch.yml 添加一下内容 :

  bootstrap.memory_lock: false
  bootstrap.system_call_filter: false

问题五:max number of threads [1024] for user [es] likely too low, increase to at least [4096]

解决方法:

 切换到root用户,进入limits.d目录下修改配置文件。
 vi /etc/security/limits.d/90-nproc.conf 
 修改如下内容:

 * soft nproc 1024
 #修改为
 * soft nproc 4096

问题六:
failed to load elasticsearch nodes : org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];

解决办法:
 curl -XPUT -H "Content-Type: application/json"  http://master:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

问题七:

java.lang.RuntimeException: can not run elasticsearch as root

解决方法:

   ElasticSearch的保护机制,root启动权限太大,默认不让ElasticSearch使用root权限启动。可以切换到es的用户,然后启动即可。例如:

最后,欢迎热爱技术的小伙伴加入我们的聊天群qq:852278138

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值