Elasticsearch OutOfMemoryError Java堆空间

 隐之王语录 发布于 2022-12-07 12:39

我正在运行一个8核,32g RAM弹性搜索节点,包含5个分片,4亿个(小)文档.

一切都运行良好,直到我运行agg搜索,然后分片开始失败:

java.lang.OutOfMemoryError: Java heap space

我用以下内容更改了堆大小 :( export ES_HEAP_SIZE=16gES_MAX_MEMES_MIN_MEM相同)

还更改了ymlelasticsearch 的文件:

bootstrap.mlockall: true

甚至(安装文件推荐):

sudo sysctl -w vm.max_map_count=262144

重启服务仍然没有影响 java.lang.OutOfMemoryError: Java heap space

还有其他建议吗?除了不运行agg查询?

查询是:

https://localhost:9200/my_index_name/_search?search_type=count
{
  "aggs": {
    "distinct_hostname": {
      "cardinality": {
        "field": "hostname"
      }
    }
  }
}

B.P.. 19

我想我发现了这个错误.我使用'service'来运行elasticsearch,因此我的环境变量被剥离了.我不得不/etc/default/elasticsearch使用correcct env变量更新文件(特别是ES_HEAP_SIZE=16g).

到目前为止,它运行良好,应用程序没有错误.

2 个回答
  • 我想我发现了这个错误.我使用'service'来运行elasticsearch,因此我的环境变量被剥离了.我不得不/etc/default/elasticsearch使用correcct env变量更新文件(特别是ES_HEAP_SIZE=16g).

    到目前为止,它运行良好,应用程序没有错误.

    2022-12-11 02:03 回答
  • 不是EXPORT _JAVA_OPTIONSEXPORT ES_HEAP_SIZE或者不是使用命令行参数来更新Elasticsearch 5的Java堆大小的正确方法。据我所知,所有这些都被Elasticsearch安装目录中的配置文件覆盖config/jvm.options。要更改这些设置,您需要在该文件中编辑以下行:

    # Xms represents the initial size of total heap space
    # Xmx represents the maximum size of total heap space
    
    -Xms2g
    -Xmx2g
    

    2022-12-11 02:06 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有