简体   繁体   English

在MacOS Mojave(自制安装)上忽略Elasticsearch 2.4 jvm.options

[英]Elasticsearch 2.4 jvm.options ignored on MacOS Mojave (Homebrew install)

I've installed ElasticSearch 2.4 on my mac via HomeBrew. 我已经通过HomeBrew在Mac上安装了ElasticSearch 2.4。 I'm trying to see if I can increase the JVM heap size for ElasticSearch. 我正在尝试查看是否可以增加ElasticSearch的JVM堆大小。

I changed the following lines (to set the heap size to 8 gigs) in /usr/local/etc/elasticsearch/jvm.options 我在/usr/local/etc/elasticsearch/jvm.options更改了以下几行(将堆大小设置为8 gigs)

-Xms8g
-Xmx8g

I then restart the service using brew services restart elasticsearch@2.4 and run curl localhost:9200/_nodes/stats/jvm?pretty to check the JVM size but I get back: 然后,我使用brew services restart elasticsearch@2.4启动服务,然后重新启动curl localhost:9200/_nodes/stats/jvm?pretty并运行curl localhost:9200/_nodes/stats/jvm?pretty来检查JVM的大小,但是我得到了:

"mem" : {
      "heap_used_in_bytes" : 144690472,
      "heap_used_percent" : 13,
      "heap_committed_in_bytes" : 259522560,
      "heap_max_in_bytes" : 1038876672,
      "non_heap_used_in_bytes" : 62484680,
      "non_heap_committed_in_bytes" : 65093632,
      ...

Why are my Xms8g and Xmx8g flags being ignored in jvm.options , and what should I do to make elsaticsearch respect them? 为什么我的Xms8gXmx8g标志正在忽略jvm.options ,和我应该怎么做才能让elsaticsearch尊重他们?

I've been basing my actions on: How to change Elasticsearch max memory size 我一直基于以下行动: 如何更改Elasticsearch最大内存大小

Figured it out! 弄清楚了!

You need to change the environment variables passed through the plist used to launch elasticsearch. 您需要更改通过用于启动elasticsearch的plist传递的环境变量。

In /usr/local/Cellar/elasticsearch@2.4/2.4.6/homebrew.mxcl.elasticsearch@2.4.plist , under the <key>EnvironmentVariables</key> key, add: /usr/local/Cellar/elasticsearch@2.4/2.4.6/homebrew.mxcl.elasticsearch@2.4.plist<key>EnvironmentVariables</key>键下,添加:

<dict>
  <key>ES_HEAP_SIZE</key>
  <string>2g</string>
</dict>

Beware, there's another plist that exists in ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist . 当心, ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist中存在另一个plist Changing this does nothing since it gets overwritten by brew services on restart. 更改此操作无济于事,因为重新启动后它会被brew services覆盖。

Also of note, there are two jvm.options files to do with ElasticSearch visible on your system: 还要注意的是,有两个jvm.options文件与在系统上可见的ElasticSearch有关:

  • /usr/local/Cellar/elasticsearch@2.4/2.4.6/libexec/config

  • /usr/local/etc/elasticsearch/jvm.options

It looks like one of these is just a symlink to the other, and changing the memory flags in either of them does absolutely nothing. 看起来其中一个只是与另一个的符号链接,并且更改其中一个的内存标志绝对没有任何作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM