Error
Error Code:
74
MongoDB Error 74: Node Not Found
Description
This error indicates that MongoDB attempted to connect to a specific node (such as a replica set member or a sharded cluster component) but was unable to locate it. This typically occurs when a configured server is unreachable or its address information is incorrect.
Error Message
Node Not Found
Known Causes
4 known causesIncorrect Configuration
The replica set or sharded cluster configuration contains an incorrect hostname, IP address, or port for a node, causing MongoDB to search for a non-existent or wrongly specified address.
Network Connectivity Issues
Firewalls, network ACLs, or general network outages are preventing the MongoDB process from establishing a connection to the target node's address and port.
Node is Offline or Unreachable
The specified MongoDB node is not running, has crashed, or is otherwise not available on the network at the expected address and port.
DNS Resolution Failure
If hostnames are used in the configuration, the system's DNS resolver might be unable to correctly resolve the hostname of the target node to its IP address.
Solutions
3 solutions available1. Verify Replica Set Member Status easy
Check if the node is actually running and reachable within the replica set configuration.
1
Connect to any member of the MongoDB replica set using the `mongosh` shell.
mongosh <connection_string>
2
Run the `rs.status()` command to get the current status of the replica set.
rs.status()
3
Examine the output for the node that is reporting 'Node Not Found'. Look for its `health` status. A `health` value of `1` indicates it's healthy. If it's `0` or absent, it's considered unhealthy or unreachable.
Example of healthy node:
{
"_id" : "myReplicaSet",
"version" : 1,
"members" : [
{
"_id" : 0,
"name" : "mongodb1:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"optime" : Timestamp(...)
},
// ... other members
],
// ... other fields
}
4
If the node is not listed or has a health status of `0`, investigate the node itself. Ensure the MongoDB process is running on that host and port.
# On the problematic node (Linux/macOS)
ps aux | grep mongod
5
If the MongoDB process is not running, start it. The command will vary based on your installation method (e.g., systemd, init.d, manual start).
# Example using systemd (Linux)
sudo systemctl start mongod
6
If the process is running but still unreachable, check network connectivity between the replica set members. Ensure firewalls are not blocking communication on the MongoDB port (default 27017).
# On a different node, ping the problematic node
ping <problematic_node_hostname_or_ip>
7
If the node is healthy and running but still not recognized by the replica set, it might be a configuration issue. Consider re-adding the node if it was recently removed or if its configuration has changed.
2. Reconfigure Replica Set Membership medium
Remove and re-add the problematic node to the replica set configuration.
1
Connect to the PRIMARY member of the replica set using `mongosh`.
mongosh <connection_string_to_primary>
2
Get the current replica set configuration.
rs.conf()
3
Identify the problematic member in the output. Note its `_id` and `host` (hostname:port).
Example of a member object:
{
"_id" : 1,
"host" : "mongodb2:27017"
}
4
Remove the problematic member from the replica set configuration. Replace `<member_id>` with the `_id` of the member you want to remove.
rs.remove("<member_id>")
5
Stop the MongoDB process on the problematic node if it's running.
# On the problematic node (Linux/macOS)
sudo systemctl stop mongod
6
Ensure the MongoDB configuration file (`mongod.conf`) on the problematic node correctly specifies its hostname and the replica set name.
Example `mongod.conf` snippet:
replication:
replSetName: "myReplicaSet"
net:
port: 27017
bindIp: 0.0.0.0
7
Start the MongoDB process on the problematic node.
# On the problematic node (Linux/macOS)
sudo systemctl start mongod
8
Re-add the node to the replica set. Replace `<hostname:port>` with the actual hostname and port of the node.
rs.add("<hostname:port>")
9
Verify the replica set status again using `rs.status()` to confirm the node has rejoined and is healthy.
rs.status()
3. Check MongoDB Configuration File medium
Ensure the replica set configuration in `mongod.conf` is correct on the problematic node.
1
Locate the MongoDB configuration file. Common locations include `/etc/mongod.conf` on Linux, or within the MongoDB installation directory on Windows.
2
Open the configuration file with a text editor.
# On Linux
sudo nano /etc/mongod.conf
3
Verify the `replication` section. Ensure `replSetName` is set to the correct name of your replica set.
replication:
replSetName: "your_replica_set_name"
4
Confirm the `net` section is correctly configured for the port and `bindIp`. For a replica set member, `bindIp` should typically be `0.0.0.0` or a specific IP address that allows other members to connect.
net:
port: 27017
bindIp: 0.0.0.0
5
If you made any changes, save the configuration file.
6
Restart the MongoDB service for the changes to take effect.
# On Linux
sudo systemctl restart mongod
7
After restarting, check the replica set status from another member to see if the node is now recognized.
mongosh <connection_string_to_primary>
rs.status()