在mac上安装MongoDB

当我在学习WebSocket初级教程时,被告知需要使用MongoDB,所以我在我的Mac上安装了MongoDB。

我参考了这篇文章:

在本地安装MongoDB。

然后最后


To have launchd start mongodb at login:
    ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
    mongod --config /usr/local/etc/mongod.conf
==> Summary

 


ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

运行。


mongo

 

所以,这次的主要目的是要使用WebSocket进行PC之间的通信,因此需要将默认的IP地址更改。
配置文件位于
/usr/local/etc/mongod.conf
将bind_ip设置为本地IP。

结束。