검색엔진/ElasticSearch

Window 환경에서 Docker로 실행할 때 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 이런 에러가 발생한다면?

ZzangHo 2022. 2. 17. 15:29
728x90

오늘은 Window환경에서 Docker로 ElasticSearch를 실행할 때 발생할 수 있는 에러메세지의 해결방법을 기록해본다.

 

max_map_count란?

기본적으로 자바 기반의 어플리케이션은 가상머신 위에서 돌아가도록 설계가 되어잇으며 JVM을 통해 할당받은 힙 메모리만 사용할 수 있다. 하지만 루씬의 경우 대용량 세그먼트를 생성하고 관리하기 위해 많은 리소스를 필요하다.

루씬은 내부적으로 자바에서 제공하는 NIO 기술을 활용한다고 한다. 이를 통해 운영체제 커널에서 제공하는 mmap 시스템콜을 직접 호출 할 수 있다.

이로 인해 커널 레벨의 파일 시스템 캐시를 사용할 수 있다.

 

 

 

 

이슈

도커로 ElasticSearch를 Window에서 띄웠는데 다음과 같은 메세지가 Docker Container 로그에 찍혀 있다면?

es-loc | ERROR: [1] bootstrap checks failed

es-loc | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

es-loc | {"type": "server", "timestamp": "2022-02-17T14:04:56,978+09:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-cluster-loc", "node.name": "es-loc", "message": "stopping ..." }

es-loc | {"type": "server", "timestamp": "2022-02-17T14:04:57,007+09:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-cluster-loc", "node.name": "es-loc", "message": "stopped" }

es-loc | {"type": "server", "timestamp": "2022-02-17T14:04:57,007+09:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-cluster-loc", "node.name": "es-loc", "message": "closing ..." }

es-loc | {"type": "server", "timestamp": "2022-02-17T14:04:57,016+09:00", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-cluster-loc", "node.name": "es-loc", "message": "closed" }

es-loc | {"type": "server", "timestamp": "2022-02-17T14:04:57,018+09:00", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "es-cluster-loc", "node.name": "es-loc", "message": "Native controller process has stopped - no new native processes can be started" }

es-loc exited with code 78

 

바로 mmap 카운트가 넉넉하지 않아 자동으로 ElasticSearch에서 경고 메세지를 띄우고 종료가 된 케이스이다.

 

해결책

다음 명령어를 순서대로 입력한다.

wsl -d docker-desktop
sysctl -w vm.max_map_count=262144