Elasticsearch ‘max virtual memory areas vm.max_map_count [65530] is too low,’で停止してしまう場合の対処

Elasticsearch ‘max virtual memory areas vm.max_map_count [65530] is too low,’で停止してしまう場合の対処

Docker環境にてElasticsearchを動作させた場合に下記の様に’max virtual memory areas vm.max_map_count [65530] is too low’で停止してしまう場合の対処

es01       | ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
es01       | bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
es01       | ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/es-docker-cluster.log

対処

コンソールにてシステムパラメータのvm.max_map_countの値が小さいために発生しているので、この値を大きくする
この値はプロセスが使用可能なメモリマップ領域の最大数を設定するパラメータです
(デフォルトでは65535)

システムパラメータの確認方法

/sbin/sysctl -a

コンソールから下記コマンドにより変更

sudo sysctl -w vm.max_map_count=262144

Linux kernel Documentationの仮想メモリに対して下記の記述があります

==============================================================

max_map_count:

This file contains the maximum number of memory map areas a process
may have. Memory map areas are used as a side-effect of calling
malloc, directly by mmap, mprotect, and madvise, and also when loading
shared libraries.

While most applications need less than a thousand maps, certain
programs, particularly malloc debuggers, may consume lots of them,
e.g., up to one or two maps per allocation.

The default value is 65536.

=============================================================

(日本語訳)

このファイルには、プロセスのメモリマップ領域の最大数が含まれています
がある可能性があり。メモリマップ領域は、呼び出しの副作用として使用されます
malloc、mmap、mprotect、およびmadviseによって直接、またロード時に
共有ライブラリ。

ほとんどのアプリケーションに必要なマップは1,000未満ですが、特定の
プログラム、特にmallocデバッガーは、それらを大量に消費する可能性があります。
たとえば、割り当てごとに最大1つまたは2つのマップ。

デフォルト値は65536です。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です