MongoDB 에서 wiredTiger engine 파일 찾는 법
찾게 된 이유 : 몽고디비에서 CRUD를 할때 checksum이 match가 되지 않는 오류 발생 => 몽고디비 다운으로 이어졌다.
log를 찾아보면, collection-218–4990451227493674325.wt 식의 파일 이름들이 보임.
해당 wt파일이 어떤 database의 collection인지 찾아 볼 수 있음.
from pymongo import MongoClient
conn = MongoClient(host='host', port=port, username='username', password='password')
databases = conn.list_database_names()
# 몽고디비에서 wt파일 찾는 법.
for db_name in databases:
db = conn[db_name]
collections = db.list_collection_names()
for coll_name in collections:
stats = db.command("collstats", coll_name)
if 'wiredTiger' in stats and 'uri' in stats['wiredTiger']:
uri = stats['wiredTiger']['uri']
if "~~파일이름~~" in uri:
print(f"Found in {db_name}.{coll_name}")
이렇게 하면 wt파일이 어느 database의 collection인지 찾아볼 수 있다.


댓글 남기기