Has*_*san 1 .net c# elasticsearch
如何检查分配给Elasticsearch引擎的堆大小,是否可以使用URL API进行检查?我可以使用NEST进行检查吗?
谢谢
在集群环境中,堆设置可以查询为:
curl -sS "localhost:9200/_cat/nodes?h=heap*&v"
Run Code Online (Sandbox Code Playgroud)
例如:
curl -sS "localhost:9200/_cat/nodes?h=heap*&v"
heap.current heap.percent heap.max
321.1mb 32 989.8mb
424.1mb 42 989.8mb
280.3mb 28 989.8mb
Run Code Online (Sandbox Code Playgroud)
这也可以从 ps 结果中检查,尽管它只会阐明最小值-最大值。
~#ps aux | grep --color=auto -i Xms
elastic 6020 0.0 0.0 12788 936 pts/4 S+ 04:24 0:00 grep --color=auto -i Xms elastic+ 7218
0.6 9.5 5001220 1565112 ? Ssl Jun24 5:14 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.WoiU4NhH -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/var/log/elasticsearch/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms1g -Xmx1g -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=deb -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet
Run Code Online (Sandbox Code Playgroud)
其中 -Xms 是最小堆,-Xmx 是配置的最大堆。
根据在线文档,默认堆大小为 1 Gb,除非您在环境变量 [ES_HEAP_SIZE] 中明确提及
Elasticsearch 默认安装配置有 1 GB 堆。对于几乎所有部署来说,这个数字都太小了。如果您使用默认堆值,则您的集群可能配置不正确。
有两种方法可以更改 Elasticsearch 中的堆大小。最简单的方法是设置一个名为 ES_HEAP_SIZE 的环境变量。当服务器进程启动时,它将读取此环境变量并相应地设置堆。例如,您可以通过命令行进行设置,如下所示:
export ES_HEAP_SIZE=10g 或者,您可以在启动进程时通过命令行参数传入堆大小(如果这对您的设置来说更容易):
./bin/elasticsearch -Xmx10g -Xms10g
确保最小 (Xms) 和最大 (Xmx) 大小相同,以防止堆在运行时调整大小,这是一个成本非常高的过程。
通常,设置 ES_HEAP_SIZE 环境变量优于设置显式 -Xmx 和 -Xms 值。
| 归档时间: |
|
| 查看次数: |
2601 次 |
| 最近记录: |