Elasticsearch问题总结

Posted 一笑之奈何

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch问题总结相关的知识,希望对你有一定的参考价值。

1.ES大量做FULL GC,日志如下:

[2016-12-15 14:53:21,496][WARN ][monitor.jvm ] [vsp4] [gc][old][94725][4389] duration [26.9s], collections [1]/[27s], total [26.9s]/[15.9h], memory [19.7gb]->[17gb]/[19.8gb], all_pools {[young] [1.1gb]->[43.1mb]/[1.1gb]}{[survivor] [130.2mb]->[0b]/[149.7mb]}{[old] [18.5gb]->[16.9gb]/[18.5gb]}
[2016-12-15 14:53:57,117][WARN ][monitor.jvm ] [vsp4] [gc][old][94731][4390] duration [29.9s], collections [1]/[30.4s], total [29.9s]/[15.9h], memory [18.6gb]->[18gb]/[19.8gb], all_pools {[young] [71.1mb]->[51.8mb]/[1.1gb]}{[survivor] [149.7mb]->[0b]/[149.7mb]}{[old] [18.4gb]->[18gb]/[18.5gb]}
[2016-12-15 14:54:31,246][WARN ][monitor.jvm ] [vsp4] [gc][old][94735][4391] duration [30.6s], collections [1]/[31.1s], total [30.6s]/[15.9h], memory [18.5gb]->[17.9gb]/[19.8gb], all_pools {[young] [14.3mb]->[1.3mb]/[1.1gb]}{[survivor] [22.1mb]->[0b]/[149.7mb]}{[old] [18.4gb]->[17.9gb]/[18.5gb]}

ES内存配置策略有2点:

1.不超过可用内存的50%

2.不超过32G

fielddata加载数据到内存是按index来的,不会只加载检索结果数据,indices.fielddata.cache.size(5gb or 20%)控制fielddata可用内存,内存不够时,淘汰老数据,ES默认不淘汰。设置该值并不好,这样内存不够时每次会从磁盘读取,引起大量磁盘I/O,但如果想要ES只缓存最近的数据到内存,需要配置。

 监控fielddata

  • per-index using the indices-stats API:

    GET /_stats/fielddata?fields=*
  • per-node using the nodes-stats API:

    GET /_nodes/stats/indices/fielddata?fields=*
  • Or even per-index per-node:
GET /_nodes/stats/indices/fielddata?level=indices&fields=*

By setting ?fields=*, the memory usage is broken down for each field.

fielddata circuit breaker可以在fielddata加载到内存前预估内存是否够用,如果内存不够用而继续读取fielddata到内存会导致内存溢出

连接:https://www.elastic.co/guide/en/elasticsearch/guide/current/_limiting_memory_usage.html

以上是关于Elasticsearch问题总结的主要内容,如果未能解决你的问题,请参考以下文章

BootStrap有用代码片段(持续总结)

BootStrap实用代码片段(持续总结)

python常用代码片段总结

Elasticsearch笔记九之优化

回归 | js实用代码片段的封装与总结(持续更新中...)

ElasticSearch本人启动报错总结