MongoDB: No host in new replica set maps to this node

In the “trivial-errors” category, I imagine one will encounter this error when setting up MongoDB replica sets.

What this means is that the current instance cannot connect to host 1 in my rsconfig for a few possible reasons.

  • A firewall or network configuration blocking access to the MongoDB port.
  • The host cannot be resolved.
  • There is not mongod instance specified on that host:port.
  • And more

So the next time you see these errors, check your replica set config, make sure you can connect to each node first.