can't connect mongo atlas into mongodb compass, shell and Go app - mongodb

i think this question been asked many times, but i've had this issue also last year and another last year, i resolved it to use VPN provider like nordvpn and tunnelBear. my issue here my company has own VPN which to connect to some internal apps, but i cant connect with multi VPN, my company VPN not resolved the issue to connect Mongo Atlas into Compass, after i install NordVPN in my Linux Fedora, it was solve, but i can't open another internal app if i dont connect with my company VPN. so i tried connect my company VPN while my NordVPN connected as well, but it doesnt work. i need to turn off my private VPN to connect my company VPN. this is really confusing for me if keep to turn off and on my private VPN and Company VPN for my work.
wha i have tried to fix this issues but always failed
change DNS on my fedora /etc/resolv.conf into nameserver 0.0.0.0 or nameserver 8.8.8.8;
change net.bindIp on /etc/mongod.conf into 0.0.0.0 and my ip;
listed ip public in Mongo Atlas 0.0.0.0;
error on mongo compass after paste the URI:
querySrv ENODATA _mongodb._tcp.companyNameHere.ycex0.mongodb.net
error in mongo shell
MongoDB shell version v4.4.3
exception: Failed to look up service "_mongodb._tcp.companyNameHere.ycex0.mongodb.net": Success
exiting with code 1
error in Go app:
panic: error parsing uri: lookup _mongodb._tcp.companyNameHere.ycex0.mongodb.net on XXX.XXX.1.1:53: no such host
those ways not work in my Fedora, i cant connect Mongo Atlas URI in Compass, Go App and Shell as well,
is that any another way ?
my os is: Fedora 33

Try using the standard connection string , as SRV strings sometimes not resolvable by some of the images.
The standard connection string can be obtained in the Atlas UI for the version 3.4 earlier

Related

Can't connect to MongoDB on VPS

I'm trying to connect from MongoDB compass to my database which is on VPS. MongoDB itself is working on the VPS. As well I allow firewall to connect from my IP. But it's still doesn't allow me to go. Error - connect ECONNREFUSED "ipaddress:port"
I also tried to use SSH tunnel with the same IP and port and I'm getting confused which SSH username and SSH password I need to use?
I'm using Ubuntu 18.04 on my VPS.
I checked so many resources on how to connect but doesn't find any helpful. First the problem was with Firewall and allowance of ports and IP. But now i'm 100% sure that I allow it in firewall.
For SSH Hostname - I use my IP
SSH Tunnel port - I use port which I allow
GOAL: Any solution how I can connect my MongoDB which is on VPS to MongoDB Compass? I'm really clueless on how to get it.
EDIT1
This error I receive after I'm trying to connect with MongoDB Compass -
Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused
When I change the port I receive this error - Error creating SSH Tunnel: connect EADDRINUSE

How to connect to DogitalOcean Droplets database with MongoDB Compass?

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.

MongoDB not running on the provided host and port

I tried to connect to my local mongodb server through compass but It throws me an error "MongoDB not running on the provided host and port", I tried to change the config file many times. I tried setting
"bindIpAll: true" , bindIp: my hostname(IPv4 Address), comment the line. Everything is a failure. Anybody help me with this.
Thanks in Advance.
Just go to task manager then click on services and search for MongoDB, right click on it and start the service.
This works for me.
Have you try port number after IP address 27017 followed by ":".
I had this issue when attempting to connect with mongoDB Compass to a mongoDB on an AWS Ubuntu Linux instance (Lightsail Service to be exact).
After reading lots of similar questions here and elsewhere (and having checked my firewall rules to allow port 27017 connections) I went to check the /etc/mongodb.conf file.
By default the bind_ip (at row 11 in my system) comes configured as 127.0.0.1, and that is fine to connect from the same machine. In this config entry you should put all the IP's that are listening for connections.
I tried to add my instance public IP just after a comma
bind_ip = 127.0.0.1,35.xx.xx.xx (where 35.xx.xx.xx was my public IP)
At this point the service didn't start anymore. I started the service manually while following the log (look under /var/log/mongodb) to read this error message:
2019-03-19T15:51:59.338+0000 [initandlisten] ERROR: listen(): bind() failed errno:99 Cannot assign requested address for socket: 35.xx.xx.xx:27017
So I tried with 0.0.0.0 as suggested on another site but it gave a similar error.
I solved this by putting my AWS instance private IP address in the config file:
bind_ip = 127.0.0.1,172.xx.xx.xx (where 172.xx.xx.xx is your PRIVATE IP)
Hope this helps!
I have stumbled with the same issue while using latest mongodb v:6.14.4, my solution is to open cmd and run 'mongo' this gives the path where the mongodb is running if already installed, copy the path from cmd and you can use as below in your node module:
const mongodb = "mongodb://127.0.0.1:27017/database-name";

Connecting to MongoDB hosted on Amazon EC2 (using PyMongo)

I'm having trouble remotely connecting to my MongoDB instance; I've deployed it using the MongoDB AWS Quick Start, and can connect via SSH as per the "Testing" section of the Quick Start guide.
However, when trying to connect remotely (I'm using the PyMongo driver), I run into a pymongo.errors.ServerSelectionTimeoutError: ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com:27017: timed out error.
I've tried setting bind_ip to 0.0.0.0 as well as an Elastic IP to the VPC instance that the mongod is running on, but to no avail. In fact, even pinging the EIP leads to a timeout (although pinging the NAT instance doesn't).
With PyMongo I've tried both DNS's, with and without SSL. I can successfully connect to MongoDB on localhost.
These are the security groups for the VPC: AWS security groups
If anyone has a clue on what I might be doing wrong I would greatly appreciate it; I've been struggling with this for over a day now. Thanks!

mongodb could not connect to server

I'm new to MongoDB. I'm trying to connect to my remote mongo database from my work machine( I tried for both mongohq as well as mongolab). I'm getting the error listed below. When I run the same command from my home machine it runs fine and does connect to remove mongo database. I'm not sure what is messed up on my work machine but I'd like to fix it. Thanks for you help.
MongoDB shell version: 2.4.9
connecting to: linus.mongohq.com:10097/mydb
Thu Jan 16 04:16:02.689 Error: couldn't connect to server linus.mongohq.com:10097
at src/mongo/shell/mongo.js:147
exception: connect failed
As per question comments, your mongo shell client can't connect to the mongo instance. Assuming that your internet connectivity is fine, the most common reason for the failure is that the ports are blocked on your network.
Some ISPs automatically block these ports by default as an additional security protection for users that don't need them open. Contact your ISP or network admin, they should be able to help you out.