• Elasticserach常见问题


    启动:

    直接启动: ./bin/elasticsearch

    后台启动:./bin/elasticsearch -d

    测试: curl http://192.168.2.101:9200

    停止:

    查看es进程: jps | grep Elasticsearch

    杀掉进程: kill -9 进程号

    问题及解决

    问题1:

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

    解决方法:

    vim /etc/security/limits.conf

    在最后面追加下面内容:

    francis hard nofile 65536

    francis soft nofile 65536 # francis为es安装目录的所有者

    或者:

    soft nofile 65536

    hard nofile 65536 # *表示所有用户,nofile表示最大文件句柄数,表示能够打开的最大文件数目

    修改后退出重新登录,使用如下命令查看是否修改成功:

    ulimit -Hn

    ulimit -Sn

    问题2:

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

    解决方法:

    vim /etc/sysctl.conf

    在最后面追加内容: vm.max_map_count=262144

    查看修改后的结果:sysctl -p

    问题3:

    Java HotSpot™ 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=‘Cannot allocate memory’ (errno=12)

    解决方法:

    编辑文件 vim /usr/local/elasticsearch/config /jvm.options

    修改以下配置,将1g变为更小的值:

    -Xms1g

    -Xmx1g

    问题4:

    问题5:

    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

    解决方法:

    vim /usr/local/elasticsearch/config/ elasticsearch.yml

    添加配置:cluster.initial_master_nodes: [“node01”]

    问题6:

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

    解决办法:

    这种是权限问题,一般这种权限问题执行: chown -R francis:francis /usr/local/elasticsearch 即可解决

    分片数不够:

    [2022-03-18T09:32:07,019][WARN ][o.e.x.m.e.l.LocalExporter] [node-1] unexpected error while indexing monitoring document

    org.elasticsearch.xpack.monitoring.exporter.ExportException: org.elasticsearch.common.ValidationException: Validation Failed: 1: this action would add [1] total shards, but this cluster currently has [10437]/[10000] maximum shards open;

    解决方法:

    PUT /_cluster/settings

    {

    "transient": {

    "cluster": {

    "max_shards_per_node":20000

    }

    }

    }

    匹配通配符

    PUT /_cluster/settings

    {

    "persistent" : {

    "action.destructive_requires_name": false

    }

    }

  • 相关阅读:
    2核4G游戏服务器推荐(阿里云/腾讯云/华为云)
    Python自动化测试之request库详解(三)
    商务部研究院信用所、启信宝联合发布《中国商务信用发展指数报告(2022)》
    详解 IP 协议
    代码整洁之道第四章 注释
    STM32 HAL库多路PWM没有输出踩坑记录
    Java并发-实现带拒绝策略的线程池
    VisionPro学习笔记(2)——图像转换工具ImageCovertTool
    .NET 8 的 green thread 异步模型被搁置了
    异常Exception
  • 原文地址:https://blog.csdn.net/klvjb/article/details/128150158