Getting MongoNetworkError: connect ECONNREFUSED 127.0.0.1:2701error message

Hi All, I installed MongoDB today on my AWS Linux 2 server. It worked fine first time when I installed, was getting connected. However, it is not starting again and throwing failed connection when running sudo systemctl status mongod.

I installed using yum commands. Any help would really be appreciated.

Thanks.

Hey @Himanshu_Sethi,

Welcome to the MongoDB Community!

  • Could you check your MongoDB config file (usually /etc/mongod.conf) and make sure the net bindIp setting is correct? To read more, refer to the documentation.
  • Try restarting MongoDB with 'sudo systemctl restart mongod'. A reboot can help if MongoDB fails to start properly the first time.
  • Make sure your AWS security group allows incoming connections on port 27017 for MongoDB traffic.

In case the above steps don’t work, uninstall and reinstall MongoDB following the official documentation for your Linux distribution.

Regards,
Kushagra

It is started working. Thank you.