Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB running, but can not connect using mongo shell

Tags:

mongodb

Sometimes I can get a connection, sometimes it fails

MongoDB shell version: 2.4.3
connecting to: test
Wed Jul  3 13:07:09.878 Socket recv() errno:104 Connection reset by peer 127.0.0.1:27017
Wed Jul  3 13:07:09.878 SocketException: remote: 127.0.0.1:27017 error: 9001 socket exception [1] server [127.0.0.1:27017]
Wed Jul  3 13:07:09.878 DBClientCursor::init call() failed
Wed Jul  3 13:07:09.880 JavaScript execution failed: Error: DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:L112
exception: connect failed
like image 737
Feng Avatar asked Jul 03 '13 05:07

Feng


1 Answers

I guess that in MongoDB logs you receive this:

Wed Jul 3 13:07:... connection refused because too many open connections: 819

Try to do following:

  • kill all mongodb processes
  • start mongod:

    $ mongod
    
  • start mongo like bellow:

    $ mongo 127.0.0.1:27017
    
like image 117
Ionică Bizău Avatar answered Nov 15 '22 05:11

Ionică Bizău