[Mac] mongoで『reason: errno:61 Connection refused』が出た時の対処

MongoDB 2016年2月13日

Macで久しぶりにmongoを使おうと思ってコマンドを叩いたら以下のようなエラーが出ました。

-% mongo
MongoDB shell version: 3.0.7
connecting to: test
2016-02-13T02:10:30.013+0900 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2016-02-13T02:10:30.015+0900 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
    at connect (src/mongo/shell/mongo.js:179:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed

とりあえず色々検索したら我らがStackOverflowに解決策がありました。


[Cannot connect to mongodb errno:61 Connection refused[StackOverflow]](http://stackoverflow.com/questions/23418134/cannot-connect-to-mongodb-errno61-connection-refused)
この通りおもむろに`brew services start mongodb`を打ってみたら無事起動しました。参考までに。

slont

金融ベンチャーでWebエンジニア

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.