코딩일상

[MongoDB] WiredTiger 캐시 크기 조정 본문

카테고리 없음

[MongoDB] WiredTiger 캐시 크기 조정

solutionMan 2025. 3. 4. 15:57
반응형

기본적으로 MongoDB는 전체 RAM의 50%까지 사용

 

wiredTigerCacheSizeGB 설정을 조정

 

< mongod.conf > 파일 내용 수정 아래 와 같이

storage:
  wiredTiger:
    engineConfig:
      cacheSizeGB: 4  # 예: 4GB로 설정

 

수정후 아래 명령어를 통해  mongoDB 재시작

sudo systemctl restart mongod

 

몽고 상태 확인 명령어

sudo systemctl status mongodb

 

 

wiredTigerCacheSizeGB  설정 확인하는 방법

db.serverStatus().wiredTiger.cache["maximum bytes configured"]

결과값 변환 ==> 7740588032 / (1024 * 1024 * 1024) ≈ 7.21 GB

 

 

 

 

에러 케이스 

sudo systemctl status mongodb

 

명령어 실행시 아래와 같은 에러 발생시

  Process: 8724 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)

 

하기 명령어 3개 실행

  sudo chown -R mongodb:mongodb /var/lib/mongodb
  sudo chown mongodb:mongodb /tmp/mongodb-27017.sock 
  sudo service mongod restart

 

* 폴더의 소유자가 root나 다른 사용자로 변경되면, MongoDB가 해당 폴더에 접근할 수 없어서 실행이 안 됨.

이를 다시 mongo 쪽으로 소유를 돌리기위한 작업

 

 


참고

 

https://stackoverflow.com/questions/64608581/mongodb-code-exited-status-14-failed-but-not-any-clear-errors

 

Mongodb (code=exited, status=14) failed but not any clear errors

I have VPS with Ubuntu 18.04 LTS with Mongodb and my script was working until 3 days ago fine, but suddenly my hosting server was rebooted (I purchased it from a hosting company) and when my server...

stackoverflow.com

반응형
Comments