7 HostNotFound: Could not find host
MongoDB의미
MongoDB가 연결하려는 호스트 이름을 해석하거나 찾을 수 없었다. 드라이버나 replica set 멤버가 지정된 호스트에 도달할 수 없어 연결을 수립할 수 없다.
원인
DNS 해석 실패, 연결 문자열의 잘못되었거나 오래된 호스트 이름, 클라이언트가 해석할 수 없는 replica set 멤버 호스트 이름(rs.conf), 또는 네트워크/접근 문제가 원인이다. 컨테이너 환경에서는 외부에서 해석할 수 없는 내부 호스트 이름이 전형적인 원인이다.
해결 방법
호스트 이름이 올바르고 해석 가능한지 확인한다(ping/nslookup으로 DNS 테스트). 연결 문자열의 호스트를 갱신한다. replica set 멤버 이름을 클라이언트와 멤버 모두가 해석할 수 있도록 하고, 필요하면 rs.conf()의 호스트 이름을 접근 가능한 FQDN/IP로 갱신한다. SRV(mongodb+srv)를 사용한다면 DNS SRV 레코드를 확인한다.
같은 데이터베이스의 다른 항목
- 91 ShutdownInProgressThe server is in the process of shutting down (서버가 종료 중)
- 189 PrimarySteppedDownPrimary stepped down while operation was in progress (작업 진행 중 primary가 step down됨)
- 24 LockTimeoutOperation exceeded time limit waiting for a lock (락 대기 중 작업 시간 한도 초과)
- 175 QueryPlanKilledQuery plan killed during execution
- 11602 InterruptedDueToReplStateChangeOperation interrupted due to a replication state change (복제 상태 변경으로 작업 중단)
- 136 CappedPositionLostCapped collection position lost
- 28 PathNotViableCannot use the part of the path to traverse the element (경로의 일부로 요소를 탐색할 수 없음)