3개의 노드를 하나의 클러스터로 연동하면서 수 많은 에러를 발견하였다.
그 중에 하나가 vm.max_map_count에 대한 에러이다.
본인이 구글링과 함께 실제로 해본 내용을 바탕으로 글을 작성할 것이다.
1. 에러
elasticsearch | ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
elasticsearch | bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
elasticsearch | ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log
위의 로그처럼 도커로 구동시킨 엘라스틱서치 서버의 로그를 확인해보니 vm.max_map_count 값이 65530이기 때문에 에러가 발생하는 것을 볼 수 있다.
그래서 현재 엘라스틱서치 로그에서 vm.max_map_count을 262144로 확장시킬 것을 권장하고 있는 에러인데, 리눅스 환경에서 확장을 시켜주어야 한다.
2. 해결방법
해결할 방법은 엘라스틱서치 공식문서에도 잘 나와있고, 구글링하면 많은 사람들이 이러한 에러를 해결한 글들이 많이 올라와있다.
셜명이 워낙 잘 되어있기에 아무거나 들어가서 봐도 무방하다.
아래는 공식문서이다. 공식문서를 참고하는게 가장 좋은 방법이다.
https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
Virtual memory | Elasticsearch Guide [8.3] | Elastic
Elasticsearch uses a mmapfs directory by default to store its indices. The default operating system limits on mmap counts is likely to be too low, which may result in out of memory exceptions. On Linux, you can increase the limits by running the following
www.elastic.co
(1) 일시적으로 해결할 수 있는 방법
sudo sysctl -w vm.max_map_count=262144
sudo 관리자 권한으로 위의 코드를 입력한다.
(2) 영구적으로 해결하는 방법
sudo vim /etc/sysctl.conf
vm.max_map_count=262144
/etc/sysctl.conf 파일에 관리자 권한으로 편집 에디터를 실행시킨다.
맨 밑에 vm.max_map_count=262144를 추가하고 저장한다.
(3) 확인 방법
sudo sysctl -p
명령어로 확인하면 현재 메모리 맥스용량이 출력된다.
'데이터베이스 > ELK' 카테고리의 다른 글
[ElasticSearch] ILM 기능으로 인덱스 주기 관리 (0) | 2022.08.23 |
---|---|
[ElasticSearch] node 종류와 옵션 (0) | 2022.08.22 |
[Elasticsearch] 다른 서버에서 클러스터 구성 (노드 연동) with. docker-compose (0) | 2022.08.18 |
[ElasticSearch] 엘라스틱서치의 내부 구조 및 cluster, index, replica, shard (0) | 2022.08.12 |
[ElasticSearch] 인덱스 수명 주기 관리 (Hot, Warm, Cold) (0) | 2022.08.11 |