标签:style http io 使用 ar for 文件 数据 art
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz
然后解压:
tar zxvf mongodb-linux-x86_64-2.2.3.tgz
移动目录到/usr/local/mongodb
mv mongodb-linux-x86_64-2.2.3 /usr/local/mongodb
进入mongodb目录
cd /usr/local/mongodb
新建自定义数据目录
mkdir -p ./data/db/
新建日志目录
mkdir logs
以后台运行方式启动mongodb
/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork
显示
forked process: 18261
all output going to: /usr/local/mongodb/logs/mongodb.log
log file [/usr/local/mongodb/logs/mongodb.log] exists; copied to temporary file [/usr/local/mongodb/logs/mongodb.log.2013-03-01T04-04-28]
child process started successfully, parent exiting
设置开机自启动:
echo "/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork" >> /etc/rc.local
查看MongoDB日志
tail -f /usr/local/mongodb/logs/mongodb.log
即可对MongoDB的运行情况进行查看或排错了ps aux |grep mongodb
显示
root 18261 0.0 1.4 150392 29948 ? Sl 12:04 0:00 /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork
参数解释: --dbpath 数据库路径(数据文件)标签:style http io 使用 ar for 文件 数据 art
原文地址:http://www.cnblogs.com/merlini/p/3957645.html