I have been facing this issue since so long. I want to connect to compass or any mongo GUI tool to EC2 mongo server. I have bind_ip 127.0.0.1 in mongo.conf and don't want to open for all IP. I have tried connecting to the server through SSH but get "MongoDB not running on the provided host and port" error. Please anyone can help to connect remotely to MongoDB server.
Asked
Active
Viewed 492 times
0
-
please check whether you have open the port if not then login aws management console goto Security Group open the port of mongo – gaurav singh Jul 02 '18 at 09:36
-
yes, already open the port in security group. – Ritesh kumar Agrahari Jul 02 '18 at 09:37
-
It gets connected when I change the bind_ip to 0.0.0.0. This solution I don't want to do. Because of it open to the whole internet – Ritesh kumar Agrahari Jul 02 '18 at 09:40
-
try running this `sudo nmap -Pn localhost` will check whether port is enabled on your server or not . use your server ip and port – gaurav singh Jul 02 '18 at 09:50
-
I can see only HTTP, https, and ssh ports are open. But in the EC2 GUI, I can see 27017 port is open. How to open port for 27017 for EC2 instance – Ritesh kumar Agrahari Jul 02 '18 at 10:03
-
if you already have open the port using security group then login to your server using ssh and add sudo ufw allow 27017 – gaurav singh Jul 02 '18 at 10:13
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/174158/discussion-between-ritesh-kumar-agrahari-and-gaurav-singh). – Ritesh kumar Agrahari Jul 02 '18 at 11:10