Can Meteor connect to MongoDB over SSL? If yes, what should MONGO_URL be set to so the connection is encrypted?
Looks like you simply need to include ssl=true in your MONGO_URL connection string, e.g.
MONGO_URL=mongodb://user:password#ip:port/mydb?ssl=true
See:
https://github.com/meteor/meteor/issues/4812#issuecomment-129074941
https://forums.meteor.com/t/what-mongo-url-to-connect-to-mongodb-server-with-ssl/13223
Update:
Since writing this answer, I have actually tried and failed to use the ssl=true param in the MONGO_URL connection string.
This prompted me to explore the Mongo.setConnectionOptions method, and to publish this simple package that allows you pass in more advanced connection settings.
Yes! In fact, on Meteor's free hosting all the Mongo connection urls are SSL connection urls. It works just fine because for low-level operations with MongoDB Meteor uses the same node-mongodb-native npm module which supports SSL.
Related
I've been having issues while connecting to a MongoDB database using pymongo.
I use valid URLs, since my colleagues are using the same and it works fine for them, but I keep getting ServerSelectionTimeoutError.
The databases are hosted on MongoAtlas, do you have any idea about what the issue is?
Any issue with a ServerSelectionTimeoutError is a connection issue with the targeted database.
It turns out MongoAtlas has a nice documentation about those: https://docs.atlas.mongodb.com/troubleshoot-connection/
In my case, the issue was that I was on a network with a firewall that closed the needed 27017 port, a simple change of network did the trick.
I am using Robomongo but I am unable to connect to my mongodb since it is ssl enabled. So, I am currently connecting through cmd, but it has its limitations like page buffer and I am missing the UI experience.
RoboMongo version 10 has support for SSL, use this version.
More info - http://blog.robomongo.org/robomongo-rc10/
I'm using robomongo tool to access mongodb. When I connect into my db then
Show error details
How to fix it?
I had the same issue and was able to fix it by removing the full url (for example: mongodb://myuser:mypassword#mongodb-test.mydomain.com/my_database) in the connection tab and only putting in the mongodb server url: mongodb-test.mydomain.com.
Next, in the Authentication tab, I checked the Perform authentication checkbox, specified the Database, user name, password.
I also added the database in the Advanded tab just in case and I can now connect without error.
Try inserting only e.g: ds12345.mlab.com at address bar instead of full [http:// mongodb://<dbuser>:<dbpassword>#...] and create user to authenticate in mlab.com and then try connect to it. Something like this:
And then:
Whilst this answer is only partly related to the problem, I want to describe the solution in here.
I had this problem when trying to connect via Robo3T to a cluster of MongoDBs hosted on Atlas. They offer a connection string with the protocol in front (e.g. mongodb+srv://<USER>:<PASSWORD>#database-mongodb.net/admin). This was a combination of two problems:
Robo3T does not like the protocol mongodb+srv:// in the URI. You should use only the second part (after the #). Like: database-mongodb.net.
Robo3T does not like shards. At least I could not get to connect with it via that connection string. Fro what I understand, you need that protocol to connect to a shard. Since you can't use that kind of URI, you will need to connect directly to the primary shard. To do that, you need to build a new connection string with the URI of the primary shard. Like this: database-shard-00-00-vemhh.mongodb.net and provide the port to Robo3T. Also, you need to connect via SSL, if you're using MongoDB Atlas (a self-signed certificate configured directly in Robo3T worked for me).
Remove only [http://] worked for me
Get the newer version of the Robo3T client...it can import it automatically from +srv link
I was facing the same problem, but I can solve it by installing Robo 3T 1.3 and import connection details from MongoDB SRV connection string. See this:
Steps to connect remote DB from Robo 3T 1.3
Remember to replace the user in the connection string and the pass at Authentication Tab
The connection string in the picture is dummy by the way
I am Not able to connect mongoDB which is over the SSL. Without SSL its working fine.
I tried to ping from datasource connection setting, but its failing. Additionally I have imported public certificate to my jvm keystore.
mongodb connection url that I'm trying with is,
mongodb://[user]:[password]#[hostname]:[port]/[database]?ssl=true
Here, the issue is with ODA driver, which wasn't supporting the SSL based mongo.
Solution is to add mongo-java driver version 2.13.1 to BirtRuntime and delete existing ODA driver org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar.
Once done, connect to mongo using connection url, mongodb://[user]:[password]#[hostname]:[port]/[database]?ssl=true
Is there a way to use MongoDB authentication in Doctrine MongoDB ODM?
equivilant to db.auth(username,password) in shell
The most robust method is to specify your username and password in the connection URI (e.g. mongodb://username:password#localhost), as that will allow the driver to re-authenticate if a connection is dropped and it needs to reconnect. You can also use MongoDB::authenticate() if you need to authenticate against various DB's in a single connection, but you will have to manually re-authenticate if the connection is dropped. See the connection documentation for more examples.