小虾虎鱼

小虾虎鱼

在MacOS X中如何让MongoDB在开机时自动启动

So, everytime when I have to start my node apps I often forgot to run my MongoDB service and it is a bit annoying where you have to have one tab dedicated to something you won't touch at all and I thought I should find a way to run this from my startup item on my Mac OS X.

Luckily, this post from Hunter Ford's blog explains how to run your MongoDB in your Startup item on Mac OS X and here is how:

Create a file call org.mongo.mongod.plist in /Library/LaunchDaemons/

If you use vim you can do like this:

sudo vim /Library/LaunchDaemons/org.mongo.mongod.plist
 2017/10/01 16:42 阅读全文 »

MongoDB备份与还原

今天迁移MongoDB数据库出现了很奇怪的问题,使用的方法如下:

备份方法:
mongodump -h dbhost -d dbname -o dbdirectory
还原方法:
mongorestore -h <hostname><:port> -d dbname <path>
 2017/09/02 18:34 阅读全文 »