I'm trying to access mongodb on remote server using ssl. I followed the following tutorial [link].
I don't even know about the password part yet as I use ssh and the pem file without a password all the time.
Regardless, I used the following command:
mongod --sslOnNormalPorts <my pem file>
and got the following error:
Error parsing command line: unknown option sslOnNormalPorts
is there a simple way for me to access the remote mongodb database remotely?
EDIT Based on Comments
I read this link and tried the following:
mongo --host xx.xx.xxx.xxx/db-name --sslPEMKeyFile pemfileName.pem
I got the following error:
Error parsing command line: unknown option sslPEMKeyFile
What am I doing wrong?
You can try this command
ssh -i ~/my-aws-key.pem -N -f -L 8000:localhost:27017 ubuntu#ec2-54-252-168-106.ap-southeast-2.compute.amazonaws.com
Related
I am trying to use AWS DocumentDB.
This command works fine:
mongo --tls --host my.cluster-random.ap-south-1.docdb.amazonaws.com:27017 --tlsCAFile rds-combined-ca-bundle.pem --username mongo --password 'supersecure'
This command doesn't:
mongo 'mongodb://mongo#my.cluster-random.ap-south-1.docdb.amazonaws.com:27017/?tlsCAFile=rds-combined-ca-bundle.pem&tls=true'
I get the error:
SSL peer certificate validation failed: unable to get local issuer certificate
My impression is that the second case file doesn't get read. If I put the wrong file name in the first command - I get an OpenSSL error:
Failed global initialization: InvalidSSLConfiguration cannot read certificate authority file:
In the second case it's like doesn't matter at all. Any combination of TLS options like "ignore" didn't give any effect either.
I am lost a bit. Any advice?
Well... for what ever reason its not supported in mongo shell. From documentation:
https://docs.mongodb.com/manual/reference/connection-string/
tlsCAFile - This connection string option is not available for the mongo shell. Use the command-line option instead.
I am trying to create a mongodump of my atlas database, but I get the following error:
error parsing command line options: error parsing uri (mongodb+srv://blablabla:123#blablabla.blabla.blala.mongodb.net/DATABASENAME): scheme must be "mongodb"
try 'mongodump --help' for more information
Any idea, I am trying to automate my backups using a bash script.
I tried to change the url from mongodb+srv to mongodb but nothing happen
You are using an old version of mongodump that doesn't recognize mongodb+srv URIs. Upgrade mongodump or use a non-SRV URI.
I'm getting the following message when I try connecting to MongoLab with the command:
mongo ds035438.mongolab.com:35438/comeventsbw -u (myusername) -p (mypassword)
MongoDB shell version: 3.0.6
connecting to: ds035438.mongolab.com:35438/comeventsbw
2015-12-10T10:30:18.537-0700 I STORAGE In File::open(), ::open for '/Users/benwong/.mongorc.js' failed with errno:13 Permission denied
The ".mongorc.js" file located in your home folder could not be executed
You can try to delete the root directory .mongorc.js file. To do this in mac OS you can use cd ~/&&ls -al, if you see .mongorc.js that is owned by root, so we can use sudo rm .mongorc.js to delete it.
I got the same error in Ubuntu-18. Initially I logged in as normal user. I typed mongo on the terminal. So I got same above error. So I switched to the root user using sudo -s This time when I typed mongo command on the terminal I'm able to connect mongo server. So I thought this service is not available for the normal user.
I have a Meteor App running on Modulus.net server. The App is using by many people, So I want to use the same Database Locally. I'm using Ubuntu 12.
I read other SO Posts, but none of them found useful.
I tried this code
$ export MONGO_URL=mongodb://user:pass#mongo.onmodulus.net/dbId?autoReconnect=true&connectTimeoutMS=60000
$ meteor run
It throws an Error
Unexpected mongo exit code 45. Restarting.
Can't start mongod
MongoDB cannot open or obtain a lock on a file
I have also tried sudo mrt as I have installed meteorite, now the app is running but the database not changed.
I'm a newbie to Terminal, Is there any way to do that?
Did you replace user:pass and dbId to your username, password, and dbID?
You can use mongo mongodb://user:pass#mongo.onmodulus.net/dbId to check whether you can access it or not first.
Update
Sorry for the misleading answer, mongo shell has a bug to log in while you enter the url like so. You can see here
Your code runs successfully on my computer. You can try to delete .meteor/local and then execute meteor run again.
If you want to use sudo to execute it, add the argument -E so that the environment variables will not be reset:
sudo -E meteor run
I am trying to add new user to SASL db with:
saslpasswd2 -a memcached -c <new_user>.
Once I repeat password I get following error:
saslpasswd2: generic failure
I was not able to find any solution online...
If anyone has similar problem, solution is to add sudo before saslpasswd2...
sudo saslpasswd2 -a memcached -c <new_user>