I get this error in my terminal whenever I try connecting to MongoDB Atlas. Actually, I have my IP whitelist to 'Allow access from anywhere'. I don't know why i'm getting this problem.
I also tried:
$ mongo "mongodb+srv://cluster0-cueit.mongodb.net/test" --username <usrnm> --password <pwd>
but it gives me different error.
It looks like this is a MongoDB Atlas cluster. Please ensure that your
IP whitelist allows connections from your network.
It should be active and 0.0.0.0/0 (includes your current IP address) under Network Access
Related
I'm trying to host my backend on Heroku, but after I tried deploying I was getting an "application error" . I checked the "heroku logs" and I think the problem is my MongoDB database only accepts connection to my specific IP address.
2023-02-07T09:34:05.807213+00:00 app[web.1]: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
How do I get the IP address of Heroku so that I can add it to this whitelist?
https://i.imgur.com/K9k0TFk.png
This is the entire Heroku log just in case maybe I'm wrong about the reason it's crashing?
https://pastebin.com/btc79fQq
EDIT:
Also is there a way to connect to the mongo atlas database with username + password instead of IP address maybe?
It seems like it's very dynamic so you need an addon like Fixie socks which sets a static IP of your Heroku app for this exact purpose.
I have been trying to access my database that i created on Amazon DocumentDB via MongoDB Compass using Ec2 Instance but following is the error I keep on getting. There are no issues with the security groups, since I have made sure to give appropriate in bound request rights.
I am able to connect to the DocumentDB cluster via mongo shell after I SSH into the ec2-instance, but I cannot connect it via MongoDB Compass because it throws me the same error that has been attached in the image below
Please help!
Just use your pem file and set localhost port example here port 8000. Once run this below command then just open mongo compass and host: localhost:8000 then it will connect.
ssh -i my-aws-key.pem -N -f -L 8000:localhost:27017 ec2-user#serverIp
I have:
MongoDB Atlas Cluster
VPC Peering between GCP.
When I tried connect to DB from my home laptop:
mongo "mongodb+srv://hello-dev-x53pa.gcp.mongodb.net/test" --username myuser
I received an error:
2020-01-09T15:32:33.697+0200 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 192.168.240.4:27017 after 5000ms milliseconds, giving up.
2020-01-09T15:32:33.698+0200 W NETWORK [thread1] Failed to connect to 192.168.240.2:27017 after 5000ms milliseconds, giving up.
I see that received local IP address but I don't understand how I can connect to the my DB which in the private VPC?
I will be very happy for any help!
You have to whitelist your IP address. VPC Peering allowed GCP resources to connect to your database, but you also need to specify your private IP address.
Refer to below document to add IP address:
https://docs.atlas.mongodb.com/security-whitelist/#add-whitelist-entries
EDIT:
I wouldn't whitelist all IP addresses, just use the "current IP address" option to white list the IP address your laptop is trying to access from.
Also, try adding --password option, as this should be used in conjunction with --username option. Also, confirm that "test" db is where you created the username/password.
mongo "mongodb+srv://hello-dev-x53pa.gcp.mongodb.net/test" --username myuser --password mypassword
I have a flask app with mongoDB running on a digital ocean's droplet, and now I need to see what's inside that database.
I'm trying to connect with mongoDBCompass, but no tutorial seems to help me.
If there's another easier way to access that data, it would be helpful too.
You have several options:
Connect MongoDB Compass via an SSH tunnel.
Or use SSH tunneling with e.g.:
ssh -L <local_port>:<mongodb_hostname>:<mongodb_port> <user>#<bastion_hostname> -fN
and connect MongoDB Compass via localhost:<local_port>.
Or use the mongo shell directly on your droplet.
Or open the mongo port (typically 27017) via an inbound firewall rule and connect your favorite client to your droplets public IP.
I can successfully connected with mongodb on SlamData but for my localhost. Now I have a mongodb database on my EC2 server that database i want to connect in Ec2 then How can I ?
I know username and password. What should be a host and port?
If you are running Slamdata on your host and want to connect to MongoDB running on a remote EC2 host.
Then apart from the username and password, the host is the Public IP or host FQDN [ec2-xxxxxxx], port is 27017. For this check if your mongos is running and binding on 0.0.0.0. If it is binding to 127.0.0.1, you cannot connect remotely
Also check you AWS security group for EC2 and see that the port 27017 is open for your IP or in general to all [0.0.0.0] (this is NOT recommended!!!)
You can also review the FAQ on docs.slamdata.com located here.
Provides step-by-step troubleshooting for connecting to cloud-hosted MongoDB servers.
Additionally, the Path value refers to path inside of SlamData rather than the operating system path. For instance entering a value of aws1 results in a query path similar to the following, assuming you have a databased named demo and a collection named coll1:
SELECT * FROM `/aws1/demo/coll1`