I want to connect to a remote database using Robomongo. I can connect to to database but an error says that:
Failed to load list of databases
What should I do?
It took me 7 days to figure it out. When I have upgraded to Robo 3T version 1.3. it started working just fine. My previous version was 1.2.
Good to know if you are having this issue.
In my experience, it is related to failed database user/password authentication. So probably your IP connection to server is successful but you failed to connect to db. I suggest to double check your database username/password and try again.
And better to show what is inside "Show error details".
Go to Connection Settings -> Authentication
- Provide Database name, username, password
- Now test the connection
I ran into the same issue, then I provided the above info which solved my issue
Refer: (Vaibhav's post) Point 3.Populate DB name and username and password How to connect Robomongo to MongoDB
I have faced the same problem after updating the MongoDB version from 3.6 to 4.2 and previously I was using the Robo 3T version 1.2. So I just updated the Robo 3T version from 1.2 to 1.3 and it's started working again.
This is because whatever user you are connecting as does not have the privileges to list the databases.
https://docs.mongodb.com/manual/reference/built-in-roles/
Note that a user/role can connect and interact with a specific database/collection, but in order for Robomongo to list out the databases/collections, you need to let it connect to your database using a user that has listDatabases privileges.
check that your user has read/write & list all Databases privileges.
I had the same error ("failed to load a list of databases"). Due to some reason all my databases and collections got removed. Apparently, Robomongo couldn't handle the situation when there are no databases/collections available on the server.
To solve the issue, I connected to Mongo Shell, created a database, and created a collection there:
mongo (start mongo shell)
use local (create database named local)
db.createCollection("somename")
After that, I could connect to the Mongo server
Update: I've faced this issue again, and this time it has been caused by the fact that it was a new Mongo installation on a virtual machine, and connections from other hosts weren't allowed, so I had to modify bindIP from 127.0.0.1 to 0.0.0.0 in /etc/mongod.conf
net:
bindIp: 0.0.0.0
port: 27017
and restart mongo sudo service mongod restart
Got the same issue when using mongodb version v4.2.0, but the auth settings don't help. Keep getting the following logs when connecting from Robo 3T(i.e.mongoRobo).
2019-09-30T16:41:52.286-0400 I NETWORK [listener] connection accepted from 127.0.0.1:53862 #1 (1 connection now open)
2019-09-30T16:41:52.286-0400 I NETWORK [conn1] received client metadata from 127.0.0.1:53862 conn1: { application: { name: "robo3t" }, driver: { name: "MongoDB Internal Client", version: "3.4.3-10-g865d2fb" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "17.7.0" } }
2019-09-30T16:41:52.292-0400 E - [conn1] Assertion: Location34348: cannot translate opcode 2010 src/mongo/rpc/message.h 120
2019-09-30T16:41:52.292-0400 I NETWORK [conn1] DBException handling request, closing client connection: Location34348: cannot translate opcode 2010
2019-09-30T16:41:52.292-0400 I NETWORK [conn1] end connection 127.0.0.1:53862 (0 connections now open)
Finally resolved it by upgrading Robo 3T to v1.3(mac)
I just found out that I have to upgrade to the latest version that supports latest version of MongoDB. It worked without any authentication.
I had the same issue when I upgraded mongodb from 3.2 to 5.0 and tried to connect on Robo 3T 1.2.
Then I installed Mongo Compass, issue resolved. Issue would be resolved installing Robo 3T 1.3 too.
If you are using mongod --auth --dbpath /data/db1 command to start MongoDB, remove --auth and start it.
mongod --dbpath /data/db1
Now Robomongo will be able to connect without authentication. But starting without authentication is not safe. So take another terminal and create a user for your db using mongo command as described in this article.
use myDB
db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "dbAdminAnyDatabase", db: "admin" } ]
}
)
Now restart your MongoDB with --auth. Connect with Robomongo after configuring above authentication details in its connection settings.
mongod --auth --dbpath /data/db1
I had the same problem (using Robomongo), then, I created an user with his password to connect to the database, and now It is working ok
In my case i changed the configurations of my connection:
You go to: Manager connection >> Edit >> authentication >> rename to database to: admin
when I loaded the my connection all databases appeared.
Start mongod process. Start mongo process.
On the mongo shell you have opened type first rs.status() then rs.initiate() then rs.status().
My version is 1.4.3 Robo3T.
What worked for me is;
Go to MongoDB Connections and edit related connection
Go to Connection Settings
Under Authentication tab check the "Manually Specify visible
databases" and fill in the dbName you need to access.
It should fix.
I faced a similar issue but it was due to my own mistake. I added replication configuration int the /etc/mongod.conf file (i.e replSet name) and restarted the mongod.service without doing an rs.initiate()
After doing an rs.initiate() and doing a restart of mongod.service, my issue was resolved.
This issue only exists with ROBO3T 1.2 update to a higher version and it will go. The reason behind it is version 1.2 takes authentication but when we don't provide credentials in case of local it does not run listdatabase on startup
Related
I already setup mongod with authentication but forget to expose port 27017 to public but I don't understand why attacker can drop my database?
*** Updated, issued has been resolved, I forgot to re-enable auth after change something on config files and attacker random scripting execute drop database command on server which not enable auth.
Server Information:
MongoDB Server 4.0.3 on Ubuntu 16.04.5
You need to disable the remote access to your MongoDB.
In mongo conf file, setting bind_ip you can restrict.
Refer this link : http://wptrafficanalyzer.in/blog/enabling-and-disabling-remote-access-to-a-mongodb-server/
In your case, it might be accessible to remote users using mongoclient.
.> mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
2018-06-26T17:37:13.313+0530 I NETWORK [thread1] Socket recv() An established connection was aborted by the software in your host machine. 127.0.0.1:27017
2018-06-26T17:37:13.313+0530 I NETWORK [thread1] SocketException: remote: (NONE):0 error: SocketException socket exception [RECV_ERROR] server [127.0.0.1:27017]
2018-06-26T17:37:13.313+0530 E QUERY [thread1] Error: network error while attempting to run command 'isMaster' on host '127.0.0.1:27017' :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
This problem can happen when trying to connect to a database which requires SSL.
This error is usually caused by attempting to connect without SSL to a MongoDB server that requires it. Use the following command to connect:
mongo --ssl --username "$USERNAME" --password "$PASSWORD" --host "$HOST" --port "$PORT"
See Mongod logs to find the root cause. For me it was leaking connections from one of the clients, this is what I found in logs:
NETWORK [listener] connection refused because too many open connections:
(SSL causing the issue)
You can connect with it using this command :
mongo --host 127.0.0.1:27017 --tls --username fake --password fakepassword --authenticationDatabase admin --sslAllowInvalidHostnames
Disables the validation of the hostnames in TLS/SSL certificates.
Allows mongo to connect to MongoDB instances even if the hostname in
their certificates do not match the specified hostname.
Deprecated since version 4.2: Use --tlsAllowInvalidHostnames instead.
WARNING :
Although available, avoid using the --sslAllowInvalidCertificates
option if possible. If the use of --sslAllowInvalidCertificates is
necessary, only use the option on systems where intrusion is not
possible.
If mongosh (and other MongoDB Tools) runs with the
--sslAllowInvalidCertificates option, mongosh (and other MongoDB Tools) will not attempt to validate the server certificates. This
creates a vulnerability to expired mongod and mongos certificates as
well as to foreign processes posing as valid mongod or mongos
instances. If you only need to disable the validation of the hostname
in the TLS/SSL certificates, see --sslAllowInvalidHostnames.
See MongoDB official Doc
just go simply on task manager and click on service
see given image below to copy the link on the URL
find MongoDB and click on open Service.
see given image below to copy the link on the url
then again find MongoDB and start stopped DB to running mode just click on green point button and you MongoDB is again started connecting.
[see given image below to copy the link on the url]
In my case , I was running several applications on other ports. The above solutions did not worked well for me .
Finally I closed all the tabs of code editor and web-app , and restarted it . Now it works fine .
Well! You can just restart the system, that will also work with least hassle.
As stated, this can happen because the server requires TLS in the connection. You will see the reason in server logs.
For someone who ends here without knowing how to fix it (like me) it's worth noting how to connect to those servers:
In command line you can use the --tls option (https://docs.mongodb.com/manual/tutorial/configure-ssl-clients/)
mongo --tls [other params and/or connection string]
If using a connection string alone, you can add tls=true param:
mongo://[user]:[pass]#[host]/[db]?tls=true[&others]
I was getting error in the mongod logs that read
WiredTiger metadata corruption detected
To fix the error I did the following:
As per suggestion here I ran command mongod --dbpath /data/db --repair.
The logs from command above complained that my version of mongod was too recent (I was on 4.2.x) and I had to try on mongod 4.2 or earlier.
Downgraded to mongod 4.2
Ran command mongod --dbpath /data/db --repair again, and this fixed issue.
I do run mongod inside Docker, so I had to take an extra step to find out path of the mongo DB file, docker inspect <id of mongod container>, and grab the path from the HostConfig.Binds[0] property of the resulting JSON, and stick that in the --dbpath option of the repair command mongod --dbpath /data/db --repair
In my case it is net.maxIncomingConnections: 10 in the config file and MongoDB Compass.
All available connection slots the server has, are consumed by other clients and that causes new connection requests to just drop.
I was not aware that Compass would open so many connections. When I closed it, my problem was solved.
The default connection limit is 65536 as stated in config options
I don't know why this happens but sometimes my mongo instance fails to start properly. Just shutting it down and restarting it worked for me.
I have setup mongodb to listen on 27017 on 127.0.0.1 only. I need to keep it this way to have security on my database. Though i need to be able to connect to mongodb remotely using the Robo 3T. Is there any way to connect using the ssh connection to tunnel the connection to the localhost listening mongodb using my ssh credentials?
P.S. I kinda beginner to the mongoDB. Thanks in advance...
I've done few configurations on my Ubuntu 18 Vagrant box in order to successfully connect MongoDB remotely using Robo 3T GUI. I've explained in the following steps.
On Ubuntu server, to open mongo shell run:
$ mongo
Inside mongo shell, type following command to create new a admin user.
> use admin;
> db.createUser({user:"admin", pwd:"password", roles:[{ role: "root", db: "admin" }]});
By default mongodb is configured to allow connections only from localhost(IP 127.0.0.1). We need to allow remote connections from any ip address. The following change should only be done in your development server. Open up etc/mongod.conf file and do the following change.
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 #default value is 127.0.0.1
Also in the same mongod.conf file uncomment security option and add authorization option as shown below.
security:
authorization: enabled
Save and exit the mongod.conf file and restart mongodb server.
$ sudo service mongod restart
Download and install Robo 3T GUI tool.
On Robo 3T GUI, in the connection settings, you need to do few changes as shown on
below screen shots.
Enter mongodb admin database username and password which you have created earlier.
Here, I have entered my Ubuntu 18 Vagrant box ssh credentials.
Save the changes and press connect icon to see if the connection is working fine.
Yes, you can use SSH tunnel.
Go to: MongoDB Connections (Ctrl + N) > Create / Edit > SSH tab
Just achieved that
No need to change nothing in your mongodb settings
In robomongo use localhost:27017 as you db address
In SSH tab add your login details.
I'm using Mongo DB Version 3.4.6 on my Windows 7 laptop. I connect to MongoDB using Robo 3T version 1.1.1. I am trying to use Robo 3T to connect to a remote Mongo server.
I have edited the bind_Ip option in the mongo.conf file to include the IP Address of the remote server.
This is the error I receive:
Failed to connect to No chance to load list of databases.
When I click on error details, this is what it says: Cannot connect to MongoDB at Error: Network is unreachable.
I am connecting via the default port 27017, which works when I try to connect Robo 3T to the MongoDB on my own laptop.
I have attached the error message that I receive.
Please help me address this issue.
I know it's a little late, but i was facing the same problem. After i tried a lot of things i solved it just removing the connection from the manage connections window.
Then create it again, i know it sounds dummy but it was the only thing that worked for me
I've faced the same issue, just change bindIp to 0.0.0.0 and restart your server.
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.
I faced similar issue in Mac and couldn't find mongodb.conf to set bindIp from 127.0.0.1 to 0.0.0.0.
I installed only Robo 3T and used it.
Resolved using :
brew install mongo
brew tap mongodb/brew
brew install mongodb-community
vi /usr/local/etc/mongod.conf
Edit the bindIP in this file...By default it is present at /usr/local/etc/mongod.conf
sudo mongod restart
brew services start mongodb-community
Now in Robo 3T check if any TLS security settings are enabled.If yes, disable them and now try to connect. :)
For the ones that are having issues connecting via URI on Ubuntu, here goes a tip: I gone to TLS tab, then I selected Self-signed-certificate Authentication Method.
Also, make sure you have filled the fields correctly in the Authentication tab. In this tab I selected Auth Mechanism SCRAM-SHA-1 and worked like a charm.
Edit the mongo.conf file and comment the line:
bindIp: 127.0.0.1
I have a MongoDB database on my Linux server. I want to access it from another server. I tried to make a connection from my local computer with the Robomongo. The connection is succesfull, but the authentication fails.
How can I get the authentication credentials? Or should I change something in MongoDB before I can acces the database from another server / pc?
Someone else have set up this database, and there is no possibility to ask him this questions.
I have found the solution by my self:
The File etc/mongod.conf has a line 'bind_ip'. In this line, you originally have to add the IP address which you want to access your database. But, it don't work! You should better comment this line.
But, you don't have any authentication now, so you have to add authentication. Here you have an tutorial about this: http://ghosttx.com/2012/03/how-to-connect-to-a-remote-mongodb-server-with-mongohub-for-mac/
When you have done that, you have to enable authentication. You can do this by editing etc/mongod.conf again, and uncomment the line 'Auth = true'.
Now you can connect with you Mongo Database ;)
Ive sorted it by adding ssh option to RoboMongo following this link:
http://www.mongovue.com/2011/08/04/mongovue-connection-to-remote-server-over-ssh/
Im on OSX and connecting to Ubuntu 14 / Mongo 2.6.7 on VPS and when Ive added my ssh details to the Robomongo all seem to work ok (Ive also changed the mongo config to remove the ip_bing and enabled port 27017)
If you do not like to bother with authentication and stuff just make an SSH Tunnel:
ssh -fN -l username -i .ssh/id_rsa -L 9999:localhost:27017 remote.com
Just connect to mongodb on localhost:9999 and it will establish a connection to your mongodb on port 27017 on your server at remote.com.
Run your mongodb with following command to access mongodb from other servers
mongod --port 10945 --bind_ip 0.0.0.0
I was not able to use Robomongo with MongoDB 3.0 too (connecting from a Windows machine to a Linux one, using SSH). The only tool that works for me is MongoChef (http://3t.io/mongochef/).