es 7 jvm内存设置
elasticsearch 7 jvm内存设置
[Elasticsearch Guide 7.14] » Set up Elasticsearch » Configuring Elasticsearch » Important
官网关于堆内存设置的提示 :
https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html#heap-size-settings
Heap size settings
By default, Elasticsearch automatically sets the JVM heap size based on a node’s roles and total memory. We recommend the default sizing for most production environments.
Automatic heap sizing requires the bundled JDK or, if using a custom JRE location, a Java 14 or later JRE.
If needed, you can override the default sizing by manually setting the JVM heap size.
默认情况 es 会基于es 节点角色自动设置内存大小,推荐使用默认的设置对于多数生成环境. 注意:自动设置的情况要求是 绑定jdk 版本的,或者自己配置的jdk 是14版本的?
elk 7.0 的更新: 7.0 安装时可以下载自带java 环境的软件包。无需再配置java_home 。当然也有不带java环境的包
新特点:https://www.elastic.co/cn/blog/elasticsearch-7-0-0-released
Bundled Java
One of the more prominent “getting started hurdles” we’ve seen users run into has been not knowing that Elasticsearch is a Java application and that they need to install one of the supported JDKs first. With 7.0, we’re now releasing versions of Elasticsearch which pre-bundle the JDK to help users get started with Elasticsearch even faster. If you want to bring your own JDK, you can still do so by setting JAVA_HOME before starting Elasticsearch.
无需 jdk 版本的下载地址: https://www.elastic.co/cn/downloads/past-releases#elasticsearch-no-jdk
带jdk的: https://www.elastic.co/cn/downloads/past-releases#elasticsearch
这是 es7 中 jvm.options 关于堆内存的说明
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## and the min and max should be set to the same value. For
## example, to set the heap to 4 GB, create a new file in the
## jvm.options.d directory containing these lines:
##
## -Xms4g
## -Xmx4g
验证 ps -ef |grep elasticsearch
-
虚拟机为4G时 -Xms1960m -Xmx1960m
-
虚拟机 为8G 时 -Xms3976m -Xmx3976m
-
虚拟机 为16G 时 -Xms8008m -Xmx8008m
手动配置 参考:
https://www.elastic.co/guide/en/elasticsearch/reference/current/advanced-configuration.html#set-jvm-heap-size
-
Xms
然后Xmx
. 最小值和最大值必须相同 -
设置
Xms
和Xmx
不超过总内存的 50% -
不能超过oops的阈值
Xms和Xmx的大小不能超过32gb,这是压缩普通对象指针【oops】的近似阈值。要验证您是否低于阈值,请检查elasticsearch.logs中是否存在如下日志:
heap size [1.9gb], compressed ordinary object pointers [true]
上一篇: Cache抖动的实验