Can not access mongodb atlas from mongo shell - mongodb

I have set up a project in MongoDB atlas and created a user, followed the process as described in the documentation to white list IP, etc. However, I am not able to connect from my laptop.
Error is:
"HostNotFound: Could not find address for cluster0-6lzea.mongodb.net:27017: SocketException: No such host is known."
I have referred to similar questions, 2 of them were similar but their issue was because they dint white list the ip and another was blocked by universities' firewall. I do not have both the issues as I have whitelisted IP and I am not behind any firewall.

Related

GCP Can't Connect to MongoDB

This is my first attempt at deploying a Node.js application on a Google VM instance while connecting to MongoDB.
In MongoDB, I have whitelisted my IP address and the VM instance's IP address. When I start my server using Google Cloud Shell, I receive the following error:
op.cb(new error_1.MongoNetworkError(`connection ${this.id} to ${this.address} closed`));
^
MongoNetworkError: connection 1 to 34.71.95.215:27017 closed
I'm connecting on port 8080. The external IP is listed on my GCP instance page and when I ping it, it is up. IP: 34.68.254.120
When I whitelist 0.0.0.0/0 in Mongodb, the code runs successfully, and I can preview my app through GCP.
I created a new instance from scratch, and it also crashes with the same error.
ETA: In looking at the source code around the error message at:
...\node_modules\mongoose\node_modules\mongodb\lib\cmap\connection.js
it looks like a closed connection. The error message above spits out the IP address as the Iowa Google Data Center where my VM is housed.
I don't know what this means, but if you do, please let me know.
ETA2: I have 2 problems, and they may be connected. The first is that my VM server cannot connect to MongoDB. This should be simple -- whitelist the external IP address of my VM server. It does not work (I have to open MongoDB to 0.0.0.0/0 for it to connect).
The second is that I cannot connect to my server via the external IP address, regardless of whether MongoDB is connected or not. It "refuses to connect." I can do a web preview of my running server, though.
It seems the two may be connected somehow. I've rebooted my VM, but it did not fix anything. I whitelisted the error message IP address in MongoDB, but it did not help.
ETA3: Okay, it appears I have solved the whitelist to MongoDB issues. Through Cloud Shell, I asked my VM what the IP is. It is different than the one GCP tells me is the external IP. By adding this IP to the whitelist, I can connect between GCP VM and MongoDB. Whew. No idea why.
The VM's external IP address through my browser still gives me a cannot connect message, and when I use the new VM IP address I found through Cloud Shell, it gives me a "took too long to respond" message.
So I feel I have made progress. The remaining problem is accessing my server through Chrome.
Any suggestions on how I can investigate the issue further? I'm at a dead end. I believe the problem is likely simple given my inexperience.
Thanks!
Problem solved by a friend, for anyone in the future with this issue.
I had set up my GCP VM using Cloud Shell. I had housed my code by coping my repository through Cloud Shell. It turns out, this is more of a virtual interface with my VM, and the files are not physically on my VM. I needed to go through SSH, clone my repository there, and run my server through SSH. Cloud Shell was causing the problem.

Unable to connect to MongoDB Atlas due to corporate proxy

I'm building a MERN stack application. While using a personal network the connection made to MongoDB atlas works fine, however when I work at office I'm unable to connect to MongoDB Atlas due to corporate proxy.
I keep getting the following error:
err 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/
PS: I've whitelisted my corporate IP address and have also tried network access from anywhere option but I keep getting the same error on corporate network
I had same problem and was not able to connect despite setting any Ip to network setting , I shared mobile internet then it did connect to db

Mongodb Atlas connection issue

I just created a cluster in Mongodb Atlas and I can't connect to it either by my application or by the compass, the compass says: the certificate is not yet valid.
mongodb+srv://tbussola:#tindintest.fptqm.mongodb.net/test
In the application of moongose it points out: ould does not connect to any server in your MongoDB Atlas cluster. A common reason is that you are trying to access the database from an IP that is not whitelisted. Make sure that your current IP address is on the Atlas cluster IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
mongodb+srv://tbussola:#tindintest.fptqm.mongodb.net/?retryWrites=true&w=majority
My ip is already listed in the whitelist and it is also enabled to allow any ip. What should I do now? I'm using Linux manjaro, I'm a beginner.
I was facing the same issue. After a lot of research I finally found this: certificate is not yet valid. The time on my pc was not my actual local time. After I sync my time from windows settings. Connection worked.

MySQL Workbench cannot connect from home to Google Cloud SQL

I cannot connect to my Google Cloud SQL database from my Macbook Pro using MySQL Workbench.
I have read the help file here:
https://cloud.google.com/sql/docs/mysql/admin-tools
I have added an authorized IP address for my IP per
https://cloud.google.com/sql/docs/mysql/configure-ip#add
I created a user for the database with it set to allow to connect from any host. I get the error "Can't connect to MySQL server on 'XX.XXX.XX.XXX' (60)
I have also attempted to telnet and get a consistent error that I am unable to connect to the remote host
As far as I know, I've followed all the steps but it really seems I'm getting blocked even before the server. I am trying to connect from home and I don't believe my home firewall is blocking things. I am wondering if there's something I need to open up on the GCE firewall but I have successfully connected to this database from other outside tools (e.g., Zapier).
Your best action right now would be to create a proxy with public IP address.
https://cloud.google.com/sql/docs/mysql/connect-external-app
This link will walk you through that process. If this doesn’t solve your issue, then taking your question to ServerFault (Stackoverflow sister site) might give you a better idea of how to fix your issue.

Make PostgreSQL listen to Google Data Studio

I'm trying to connect one of my databases to Google Data Studio but I keep getting the following error:
Unable to reach the host.
I read the help page and already added the necessary IP addresses to the pg_hba.conf file this way:
hostnossl google_data_studio all 216.239.32.0/19 md5
That is just an example, but I have added all IP addresses required for the connection, 12 in total.
The connection description in Google's help pages shows these connections are non SSL (That's why I set it to hostnossl)
I've also restarted the postgresql service.
"Unable to reach the host" is a Google Data Studio error message, not a PostgreSQL message. PostgreSQL settings are irrelevant at this point. You are not reaching the server at all.
Since this just became a networking and settings issue for Google, I'm voting to close.