When I type mongo on command prompt than output like
~$ mongo
MongoDB shell version: 2.2.3
connecting to: test
But when I type mongo 127.0.0.1:28017/stu1
output :-
MongoDB shell version: 2.2.3
connecting to: 127.0.0.1:28017/stu1
Mon Mar 10 16:56:01 DBClientCursor::init call() failed
Mon Mar 10 16:56:01 Error: Error during mongo startup. :: caused by :: 10276
DBClientBase::findN: transport error: 127.0.0.1:28017 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:93
exception: connect failed
OS :- ubuntu 12.04
So please help me to solve this error.
28017 is the default port for the HTTP admin interface, so if your config is allowing HTTP, you should use a web browser to access it http://127.0.0.1:28017/
You're trying to use mongo shell to access HTTP service.
To have access to the database using HTTP protocol then use ~$ mongod --rest to start the db. Now call http://127.0.0.1:28017/stu1/coll_name in the web browser which list all the documents in your collection.
Related
I am trying to connect to a mongoLab mongoDB using mongo shell. This is the error that I am getting:
C:\Program Files\MongoDB 2.6 Standard\bin>mongo ds053332.mongolab.com:53332/stormaxdb -u abhishek -p password
MongoDB shell version: 2.6.4
connecting to: ds053332.mongolab.com:53332/stormaxdb
2015-03-18T16:44:27.740+0530 Socket recv() errno:10053 An established connection was aborted by the software in your host machine. 54.224.106.116:53332
2015-03-18T16:44:27.742+0530 SocketException: remote: 54.224.106.116:53332error: 9001 socket exception [RECV_ERROR] server [54.224.106.116:53332]
2015-03-18T16:44:27.746+0530 DBClientCursor::init call() failed
2015-03-18T16:44:27.748+0530 Error: 10276 DBClientBase::findN: transport error: ds053332.mongolab.com:53390 ns: stormaxdb.$cmd query: { getnonce: 1 } at src/mongo/sh
ell/db.js:1210
exception: login failed
I searched a lot to fix this error but did not find a concrete solution. Can anybody guide how to solve it, and why is it coming?
I faced a similar issue. It appeared that my firewall was blocking connection to mongo server. Try unblocking mongo from the firewall settings and it should work.
Hi I have installed mongodb as I did on last versions of ubuntu :
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
but now when I restart I got:
mongo
MongoDB shell version: 2.4.6
connecting to: test
Thu Jan 2 15:21:27.017 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
when I try to do:
sudo service mongodb start
mongodb start/running, process 5371
I get same error msg when I want to connet to mongo..
What can I do ?
I am trying to execute a Java script file in MongoDB at port 5930. Mongo can listen to the Database on that port:
./mongo localhost:5930
connecting to: localhost:5930/test
Server has startup warnings:
Wed Dec 18 13:15:58.906 [initandlisten]
Wed Dec 18 13:15:58.906 [initandlisten] ** WARNING: /proc/sys/vm/overcommit_memory is 2
Wed Dec 18 13:15:58.906 [initandlisten] ** Journaling works best with it set to 0 or 1
Now when I execute test.js at port 5930 but I get the following error:
./mongo test.js
connecting to: test
Wed Dec 18 13:22:56.011 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
The test.js has the following line:
conn = new Mongo("localhost:5930);
How can I run the script at port 5930? and Why did the script always try to execute from the default port (27017)?
Thanks
Mongo tries to connect itself to the local database automatically, before it looks at your script.
Connect to a local Mongo database running on an alternate port with this mongo command line:
mongo --nodb test.js
And have your code open the connection (which you already do).
I have downloaded the mongodb-linux-2.4.1 tarball. Then I untar it. go to mongodb-linux-2.4.1/bin folder and start it by
./mongo
Then I got:
li#li-HP:~/Tools/mongodb-linux-x86_64-2.4.1/bin$ ./mongo
MongoDB shell version: 2.4.1
connecting to: test
Fri Mar 29 19:29:47.958 JavaScript execution failed: Error: couldn't connect to
server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
Any suggestion?
./mongo just run mongodb client
./mongod run mongodb server
I have a replicaset where there is one primary and two secondary nodes.
Once in a while I am not able to connect to primary and i get this error which goes away after a minute or so and I am able to connect. Any thoughts why this could be happening ?
When this error happens I tried connecting to secondary and did rs.status which said
primary is still same server and running ok.
Below is the command text from the console that shows the issue.
mongo --host <hostname> --port 27017
MongoDB shell version: 2.2.2
connecting to: <hostname>:27017/test
Sat Mar 2 14:54:02 DBClientCursor::init call() failed
Sat Mar 2 14:54:02 Error: Error during mongo startup. :: caused by :: 10276 DBClientBase::findN: transport error: <hostname>:27017 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:93
exception: connect failed
mongo --host <hostname> --port 27017
MongoDB shell version: 2.2.2
connecting to: <hostname>:27017/test
rs0:PRIMARY>