7 HostNotFound: Could not find host
MongoDBWhat does it mean?
MongoDB could not resolve/find a host name it tried to connect to. The driver or a replica set member cannot reach the specified host, so the connection cannot be established.
Why does it happen?
DNS resolution failure, a wrong/stale host name in the connection string, replica set member host names (rs.conf) that the client cannot resolve, or a network/access problem. In container environments, internal host names that cannot be resolved from outside are the typical cause.
How to fix it
Verify that the host name is correct and resolvable (test DNS with ping/nslookup). Update the hosts in the connection string. Make sure replica set member names are resolvable by both clients and members; if needed, update the host names in rs.conf() to reachable FQDNs/IPs. If you use SRV (mongodb+srv), check the DNS SRV records.
More from this engine
- 91 ShutdownInProgressThe server is in the process of shutting down
- 189 PrimarySteppedDownPrimary stepped down while operation was in progress
- 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