While adding a mongoDB server, it fails with message "Unable to connect to the host / port".

While adding a mongoDB server, it fails with message "Unable to connect to the host / port".

Solution:
  • Check if the mongod / mongos instance is running in the host name specified.
  • Check if the port number is given correctly.
  • If mongod / mongos is running in authenticated mode, then enable "Is Authentication required" and give correct username and password.
  • Check for error messages in the mongod server host machine. If the connections are fully utilized, the mongod server rejects any further client connections. In this case, check the value of "maxConn" in mongod / mongos arguments or in the mongodb.conf file in the mongoDB server machine.