I'm trying to connect my local mongo db instance to my QA mongodb through mongo-connector. Below is the command i have used to connect. But after hitting the command its thinking for few seconds and coming out. I'm not seeing any error. Am i making any mistake in connecting to target mongodb instance?
C:\Dev\mongodb\mongo-connector>mongo-connector -m localhost:27017 -t mongodb://username:password#dbhost:27017/dbname -d mongo_doc_manager --oplog-ts oplog.txt
Logging to mongo-connector.log.
Related
I need to use terminal to connect to MongoDB. I have almost precisely same issue as this StackExchange question.
In my case I can correctly use Robo3T to connect. As well as use command
mongo --host 111.111.111.111 --port 111 --authenticationDatabase DB --username USER --password PASS locally. With same command executed remotely I receive following error:
No connection could be made because the target machine actively refused it.
I wanted to precisely recreate my Robo3T connection setup to see if SSH tunnel solves my issue
I have a free-tier MongoDB Atlas cluster, and I want to upload some JSON to it from my Mac.
I tried to run this:
mongoimport -h cluster0-shard-00-00-cxacx.mongodb.net:27017 -d literature -c books -u xxxx -p xxxx --file ~/Desktop/books.json --type json --ssl
However, I got this error:
Failed: error connecting to db server: no reachable servers, openssl error: SSL errors: SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
I tried without --ssl in the command, and I got this instead:
Failed: error connecting to db server: no reachable servers
Why can't it reach the server?
More info:
My mongoimport version is r3.2.22.
My OS is macOS 10.14.5.
My cluster version is 4.0.10.
The user has admin permission.
My IP address is white-listed.
I can connect to the cluster with the MongoDB Node Driver.
I get the same problem with mongofiles.
I also tried variations of the command with no success that included --authenticationDatabase admin and the name of the replica set and other server nodes.
Update: I was able to upload the JSON file by sending it to a Linux cloud server and running mongoimport from there.
Monogo atlas gives you service records (SRV) and not host.
"cluster0-shard-00-00-cxacx.mongodb.net" It is not a proper host.
Use it like:
mongoimport --uri
"mongodb://root:#atlas-host1:27017,atlas-host2:27017,atlas-host3:27017/?ssl=true&replicaSet=myAtlasRS&authSource=admin"
-d literature -c books -file ~/Desktop/books.json --type json --ssl
You will get complete URI from mongo atlas connect screen
I'm trying to connect to my database cluster on mLab through mongo shell using the commands as mentioned by the service providers but I keep getting the same error mentioning missing ";" statement. I can access the same database through mongoose client without any problem.
Any clue where I am messing up:
mongo ds117956.mlab.com:17956/image_search -u <dbuser> -p <dbpassword>
2017-11-29T03:04:33.139+0530 E QUERY [thread1] SyntaxError: missing ; before statement #(shell):1:6
you need to run from mongodb/bin
and then enter the following command: mongo ds117956.mlab.com:17956/image_search -u -p
not from mongo itself
mongo ds117956.mlab.com:17956/image_search -u -p
I have been trying to set up my first database for my python program. I installed MongoDb as well as mLab. When I start mongod and mongo it seems to be connecting correctly to the test database.
However, when I insert my user and pass to start the mongo shell, it shows me this:
Vincents-MacBook-Pro:~ vincentfortin$ mongo ds029735.mlab.com:29735/vinc_personnal -u xxxxx -p xxxx
MongoDB shell version: 3.2.8
connecting to: ds029735.mlab.com:29735/vinc_personnal
rs-ds129735:PRIMARY>
While in my other terminal window with mongod, it shows this :
[initandlisten] waiting for connections on port 27017
Am I missing something ?
Thanks.
Also, if anyone know of any ressources for mongodb with python, it would help alot as most of them don't show the very basics !
I am trying to connect to mongolab from terminal via below command
mongo ds061158.mongolab.com:61158/order_it -u <dbuser> -p <dbpassword>
I am getting the below error.
MongoDB shell version: 2.6.3
connecting to: ds061158.mongolab.com:61158/order_it
2014-07-09T13:52:44.890+0530 Error: couldn't connect to server ds061158.mongolab.com:61158 (23.22.170.205), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
What has to be done in this case?
Thanks in Advance.
It looks like your network is blocking access to that port. I'd recommend contacting your network administrator or trying from a different network.
To test your network connectivity alone (no credentials necessary) you can run this command. This example was run from my unprivileged laptop just now and demonstrates a successful test.
% mongo ds061158.mongolab.com:61158
MongoDB shell version: 2.6.1
connecting to: ds061158.mongolab.com:61158/test
rs-ds061158:PRIMARY> db.runCommand({ping:1});
{ "ok" : 1 }
rs-ds061158:PRIMARY> exit
bye
Our full connectivity troubleshooting guide is here: http://docs.mongolab.com/connecting/#help
Also, feel free to contact us as support#mongolab.com if you'd like us to dig into the specifics of your server or code. We're always happy to help!
Regards,
Jared
I know this question is old, but in case someone still faces a similar issue, this is what helped me:
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb restart
You should try to explicitly specify the port you want to use with the --port option:
mongo ds061158.mongolab.com/order_it --port 61158 -u <dbuser> -p <dbpassword>
From the mongo man pages:
--port <port>
Specifies the port where the mongod or mongos instance is listening. Unless specified mongo connects to mongod instances on port 27017, which is the default mongod port.