DNSHostNotFound: Failed to look up service "":DNS name does not exist. try 'C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe --help' for more information
I am getting this error while coonecting with Sandbox to mongo shell.
PS C:\Users\hp> mongo -version
MongoDB shell version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
allocator: tcmalloc
modules: enterprise
build environment:
distmod: windows-64
distarch: x86_64
target_arch: x86_64
What is the error? I am not able to understand.
DNS using Spectrum blocks srv requests to MongoDB Atlas. I had to change my DNS servers to Google's 8.8.8.8
guessing from the kind of question it seems that you were taking mongoDB university course M001. I too, was taking that course and have faced a similar problem. The solution is to remove the password part from the string or command. The following snippet will help to understand this.
Instead of the command-
mongo "mongodb+srv://sandbox-jbc3i.mongodb.net/test" --username m001-student --password m001-mongodb-basics
Enter-
mongo "mongodb+srv://sandbox-jbc3i.mongodb.net/test" --username m001-student
After this password authentication will be asked. Now here's a twist, you cannot see the password which you are typing in command prompt or powershell interface. Just type it and then press enter, and you will be connected to the mongoDB atlas. After that, you should see the prompt-
MongoDB Enterprise Sandbox-shard-0:PRIMARY>
Hope this helps.
I am writing this answer after researching on many websites and even contacted MongoDB support.
The problem is regarding the DNS server of your wifi. Kindly change your wifi or use the mobile hotspot and also whitelist the current connected IP on MongoDB, It will surely help, or Change the DNS of your wifi.
Please whitelist your ip first and then use a mobile-hotspot to connect. Modify the databaseuser (by changing its username and password) and then try to connect. It will work.
After install pgAdmin III from Ubuntu Software Center, I opened it and it required to add a connection to a server. So I filled in information as below:
Upon clicking on Ok Button, it showed the error message
Error connecting to the server: could not translate host name
"http://127.0.0.1" to address: Name or service not known
As message indicated, I thought the postgres service was not started. Therefore, I went on go terminal console and start service by entering sudo service postgresql start, but it returned Failed to start postgresql.service: Unit postgresql.service failed to load: No such file or directory.
. What's wrong or missing for my pgAdmin III? I'm just using Ubuntu earlier and I have never this problem on windows. Thanks.
http://127.0.0.1 is more a URL, that field is looking for a host so simply remove the http:// to leave the localhost's IP address 127.0.0.1 or type localhost if that resolves to the correct address (it should, usually, via /etc/hosts or the like)
Also, Debian/Ubuntu tend to ship the database servers separately. For Ubuntu, the postgresql package (which requires postgresql-common) package should include /lib/systemd/system/postgresql.service therefore you should be able to sudo systemctl start postgresql
Do you have postgresql (as opposed to postgresql-client) installed?
I am trying to connect Robo 3T to my online database and it doesn't seem to be working. I am able to connect to local database with it. I tried connecting using MongoDB Compass and the Details and Auth are working fine and I am able to connect. But when I connect with the same details in Robo 3T, it doesn't seem to be working. How do I fix this?
I am using Robo 3T Version 1.1
I tried same with Robomongo 1.0, and still getting the same error
Just change your bind_ip in /etc/mongod.conf from 127.0.0.1 to 0.0.0.0 then restart the service, and it works for me~
If you get the following error then you should also check the following:
The atlas servers at least require this setting, if you do not choose it, then you generally get the Network is unreachable message.
Also if you are using Atlas then you should check the Authentication tab and select SCRAM-SHA-1, however this generally results in an authentication error not a network unreachable one.
A better solution is to comment out or remove the bindIp setting from the config file /etc/mongod.conf
You must restart the service for the change to take effect
I also meet this problem when I use Robo 3T on Mac. I think there are some things you need to check to help you know what's the problem.
First try to ping the mongo server in your terminal to see whether you can get responses. If so, that's means you may set wrong mongo config in you Robo 3T.
If you cannot get the response, that means there is something wrong with your network. You should check your DNS and your network gateway. For example my DNS is 172.16.* and my network gateway (execute ifconig and check en0) is 172.17.*. And they are not belong to the same network segment. (Actually, even if they are on the same network segment, things won't work if someone polluted your DNS server.)
That's the problem. The DNS that you are using cannot interpret your mongo host correctly. Someone may had polluted this DNS server.
You can have a try on ping xxx(your mongo-server) #8.8.8.8, which will use 8.8.8.8 as your DNS. If everything goes well, then you get the sollution.
Sollution: Manually set DNS for your devices. For example, Google's public DNS, 8.8.8.8 and 8.8.4.4.
Actually, if you run dig xxx(your mongo-server) before and after you manually set DNS, you may find the response Ip differently.
Go Inside bin folder of MongoDB and run mongod command:- C:\Program Files\MongoDB\Server\4.2\bin
then open command prompt at this location and run mongod command & then try to connect with Robo 3T . It works for me.
Also create data folder inside your C: drive & then create a db named folder inside data folder. that's it.
Start the MongoDB service from the task manager.
Worked for me.
In my case both mongod and mongo.exe was throwing a 100 error code.
I had this symptom, and the ultimate fix is not yet captured in an answer here.
I was trying to connect to a mongo instance in the cloud using Robo 3T, and I was getting the "Network is unreachable" message.
Oddly, I could connect from using Robo 3T inside a Parallels VM on the same machine.
This led me to try the full Studio 3T on my mac, which could also connect just fine.
Ultimately, I discovered that there was an old dotfile from an ancient version of Robomongo that was causing the problem. rm -rf .config/robomongo did the trick. Now I can connect with the ordinary, free Robo 3T.
I'm guessing that I had an expired trial of Robomongo, from back before it was free, perhaps?
sorry if i'm late to this but i was running through the same issue all morning. You have to go through a few things first so you can troubleshoot easily
Restart the database from the terminal, hitting the database at the correct path and let it run in the background.
if the database is running then go through checking the local host address, and replace it with 127.0.0.1 instead of the generic localhost:27017
This might help, my robo mongo server is hosted in cloud. I have setup the mongodb but could not connect to it using Robo3T. Keeps telling network timedout (this means network problem). Been reading a lot to figure out the cause, suddenly I remembered I have also a security group in my cloud network. Just include the mongod port 27017 in the list of allowed incoming. That's it!
You may be seeing the following issue when starting the Robo 3T Application:
Just follow these steps, and you are good to go:
I'm using MacOS, so in your terminal use the following command to start your MonogDB Server:
/Users/vanthoff/mongodb/bin/mongod --dbpath=/Users/vanthoff/mongodb-data
mongodb-data: Directory you must have created to store all your Data.
After starting the server, go to RoboT 3T Application and connect to the server. It will start working. You can also Test it by double clicking you MongoDB Server name. It will look something like this when it starts working:
I hope it's going to work for you too. Amigos..!! 🙂
Go to services.msc and then search for mongodb server and then run the server in running status.
I have solved my error in this way.
For me, reinstall mongodb and restart my computer worked fine.
As said above, this is probably due to BindIp, if you use mac and brew to install it you won't find anything in /etc/mongod.conf instead you find it in /usr/local/etc/mongod.conf
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
Change BindIp with caution!
And same goes for running it, to start MongoDB manualy use:
mongod --config /usr/local/etc/mongod.conf
or configure autostart on login with launchd by typing:
brew services start mongodb
I've also encountered corrupted data files on my local computer here:
/usr/local/var/mongodb
just removed them and it worked, you could see in the log that errors like:
** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.6 before attempting an upgrade to 4.0; see http://dochub.mongodb.org/core/4.0-upgrade-fcv for more details.
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-08-01T00:15:50.224+0200 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2018-08-01T00:15:50.303+0200 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2018-08-01T00:15:50.501+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:501686][3594:0x7fffb492e380], txn-recover: Main recovery loop: starting at 14/3712
2018-08-01T00:15:50.598+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:598867][3594:0x7fffb492e380], txn-recover: Recovering log 14 through 15
2018-08-01T00:15:50.664+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:663976][3594:0x7fffb492e380], txn-recover: Recovering log 15 through 15
2018-08-01T00:15:50.715+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:715398][3594:0x7fffb492e380], txn-recover: Set global recovery timestamp: 0
2018-08-01T00:15:51.002+0200 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] now exiting
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] shutting down with code:62
This means mongo server is not started.
You need to run mongod command on the terminal to start the server.
if you do not have mongo db installed on your machine. Download and install from the Link.
Start your command prompt on windows.Go to the bin folder of Mongodb through command prompt and type mongod and enter.Now try to access again
I have been trying to access my mongo instance from another machine, but I get this error. I could not find many references to this whatsmyuri error. This is what I get from the external machine:
$ mongo <IP_ADDRESS>:27017/youtube_advertising -u user -p password
MongoDB shell version: 3.2.0
connecting to: <IP_ADDRESS>:27017/youtube_advertising
2016-02-19T17:10:02.923+0100 E QUERY [thread1] Error: network error while attempting to run command 'whatsmyuri' on host '<IP_ADDRESS>:27017' :
connect#src/mongo/shell/mongo.js:226:14
#(connect):1:6
exception: connect failed
I have already changed the /etc/mongod.conf file, opened connections through port 27017 (with iptables) and restarted mongo. I am able to connect via ssh to that machine.
Searching about this whatsmyuri, I ran this command on mongo:
> db.runCommand( { whatsmyuri: 1 } )
{ "you" : "127.0.0.1:36990", "ok" : 1 }
I do not know if that 36990 port is right or wrong. Just in case I opened connections from there too, but still nothing.
Any ideas?
UPDATE
Checking the /var/log/mongodb/mongod.log, this is what I get when I try to connect from remote:
2016-02-19T10:41:07.292-0600 I NETWORK [initandlisten] connection accepted from <EXT_IP_ADDRESS>:51800 #2 (1 connection now open)
2016-02-19T10:41:07.310-0600 I QUERY [conn2] operation isn't supported: 2010
2016-02-19T10:41:07.310-0600 I - [conn2] Assertion: 16141:cannot translate opcode 2010
Check your versions. That may help.
I was having the same problem. In my case, the server was version 3.2.0-rc2, while mongo shell version was 3.2.1.
Upgrading the server to 3.2.1 fixed the problem.
This issue bit me when I was running two versions (3.4 and 4.2) of MongoDB on the same Windows 10 machine. I ran v3.4 mongod with no problems mentioned in the console output, but then running the v3.4 mongo shell produced the above error. Checking the Task Manager, it turned out there was a MongoDB process (I'm not sure, but I think it was for v4.2) running. After ending that process through the Task Manager, the v3.4 mongo shell ran fine with no error.
Using mongodb-community-shell
In MacOs brew install mongodb/brew/mongodb-community-shell
It will ask you to overwrite link with mongo command.
brew link --overwrite mongodb-community-shell
The issue arises when the mongo client's and server's version mismatch.
Uninstall MongoDB from the client and for installation follow the detailed instruction provided over here.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
The key step which needs to be done with the attention is
sudo apt-get install -y mongodb-org=4.2.7 mongodb-org-server=4.2.7 mongodb-org-shell=4.2.7 mongodb-org-mongos=4.2.7
mongodb-org-tools=4.2.7
Note: In my case, the mongo version of server was 4.2.7
Another thing that one can do is uninstall MongoDB from both the systems taking necessary backups and install it again.
I came to know about mongoDB and looked for test.So I made it install and then for test when I used command mongo on terminal it showed an error like this
MongoDB shell version: 1.8.2
connecting to: test
Sun Jul 31 01:06:07 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
So can someone tell me what is the problem.I am using ubuntu 11.04.For installation instruction I had used this site.I am newbie to this mongoDB so please helpe me.Any help will be highly appreciable.
All you need to do is open 2 terminal tabs. In one, run
mongod
which starts the MongoDB server.
In the other, run
mongo
which is the shell that connects to your MongoDB server.
It looks like MongoDB isn't running. Can you connect to the web interface in your browser?
http://localhost:28017
Also, do you see the process running on your machine? You should see an entry for mongod when running ...
$ top
or
$ ps aux
why not install mongodb from 10gen's own debian repository? much easier and more likely to work
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
To see if mongodb is running, this also helps:
sudo service mongodb status
if it is running, and you still get the same error, then it must be the weird localhost bug that mongodb has. it assumes localhost is 127.0.1.1 for some reason. try
mongo 127.0.1.1
I had the same problem. Just try to create folder c:\data and next c:\data\db