LoginSignup
2

More than 5 years have passed since last update.

公式yumリポジトリで入れたElasticsearch 5.xの使用メモリを抑制するには

Posted at

CentOS 7を入れた開発用の貧弱鯖(メモリなんと2GB)で公式yumリポジトリからElasticsearchの最新版を入れて起動したところメモリを食いつぶしてちょっとしたクエリを投げるたびにプロセスが落ちるという困ったことになりました

起動時のプロセス見たら-XmsオプションでJVMが2GBも確保してくださりやがってたので嫌な予感はしてたのですが・・・

で、ぐぐってみたのですが、起動スクリプトにES_HEAP_SIZEを云々という記述はよくあるものの、どうもこれには当てはまらず

最初から読んどけという公式ドキュメントにズバリなところがありました

Set JVM heap size via jvm.options

つまり、/etc/elasticsearch/jvm.optionsファイルに全部書いてあったっていう

/etc/elaasticsearch/jvm.options

## JVM configuration

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################

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

-Xms2g  # ここと
-Xmx2g  # ここ

ここをメモリに応じて1g/1mみたいな記法で書けばいい感じ

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2