MongoDB正在运行,但无法使用MongoShell进行连接

MongoDB正在运行,但无法使用MongoShell进行连接,mongodb,Mongodb,有时我可以连接,有时它会失败 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]

有时我可以连接,有时它会失败

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

我猜在MongoDB日志中您会收到以下信息:

星期三7月3日13:07:。。。连接被拒绝,因为打开的连接太多:819

尝试执行以下操作:

  • 杀死所有mongodb进程
  • 开始
    mongod

    $ mongod
    
  • 像下面这样开始mongo:

    $ mongo 127.0.0.1:27017
    

试着这样启动mongo:
mongo 127.0.0.1:27017
@feng,请提供mongodb日志。@amezhenin,在日志中出资
[initandlisten]pthread\u创建失败:errno:11资源暂时不可用[initandlisten]无法创建新线程,关闭连接
,似乎是由于连接太多造成的