Upgraded mongo to 2.6 using home-brew and now can't connect

孤街浪徒 提交于 2020-01-25 05:05:40

问题


Running OSX 10.9.2, I just ran brew upgrade mongo which upgraded my mongo to version 2.6

As per the instructions I've run

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

But now when I run mongo it says

MongoDB shell version: 2.6.0
connecting to: test
2014-05-05T10:07:22.769+1000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2014-05-05T10:07:22.770+1000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

Things I've tried:

  1. I've seen this covered on other SX questions and people have suggested creating a /data/db folder but this wasn't needed previously and I don't want to lose the data from my old instance of mongo. Regardless, I tried it, and chowned it to allow read/write from my user account, but that made no difference. (FYI my data lives in /usr/local/var/mongodb/ which is typical I believe for OSX.)
  2. A lot of the other questions also assume Linux rather than Mac, or they wade off into PHP land which is not relevant to me.
  3. I've also tried rebooting my Mac.

回答1:


I fixed it by forcing home-brew to restart it.

brew services restart mongodb

and voila

$ mongo
MongoDB shell version: 2.6.0
connecting to: test
>

now works a treat.



来源:https://stackoverflow.com/questions/23463258/upgraded-mongo-to-2-6-using-home-brew-and-now-cant-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!