下载地址:
解压命令:tar zxf mongodb-linux-i686-2.6.0.tgz
存放目录:/usr/local/mongodb
数据目录:/mongodb/data/
日志文件:/mongodb/dblogs
没有具体的安装步骤,解压到存放目录就好了。
mongodb的bin目录下添加数据和日志存放路径:./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
pkill mongod 杀掉mongod进程,不能用kill -9杀掉mongod进程,否则就不能再启动
或者killall mongod
命令:
login as: root
password:[root@localhost ~]# cd /home/xyz/Desktop[root@localhost Desktop]# lsmongodb-linux-i686-2.6.0 mongodb-linux-i686-2.6.0.tgz vsftpd.rpm[root@localhost Desktop]# cd mongodb-linux-i686-2.6.0[root@localhost mongodb-linux-i686-2.6.0]# lsbin GNU-AGPL-3.0 README THIRD-PARTY-NOTICES[root@localhost mongodb-linux-i686-2.6.0]# rsync -a bin /usr/local/mongodb[root@localhost mongodb-linux-i686-2.6.0]# cd /usr/local/[root@localhost local]# lsbin etc games include lib libexec mongodb sbin share src[root@localhost local]# cd mongodb[root@localhost mongodb]# lsbin[root@localhost mongodb]# cd bin[root@localhost bin]# lsbsondump mongodump mongoimport mongorestore mongotopmongo mongoexport mongooplog mongosmongod mongofiles mongoperf mongostat[root@localhost bin]# cd ../[root@localhost mongodb]# lsbin[root@localhost mongodb]# mkdir data[root@localhost mongodb]# touch dblogs[root@localhost mongodb]# lsbin data dblogs[root@localhost mongodb]# cd bin/[root@localhost bin]# lsbsondump mongodump mongoimport mongorestore mongotopmongo mongoexport mongooplog mongosmongod mongofiles mongoperf mongostat[root@localhost bin]# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork2014-04-27T08:06:43.480+08002014-04-27T08:06:43.480+0800 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.2014-04-27T08:06:43.480+0800about to fork child process, waiting until server is ready for connections.forked process: 4489child process started successfully, parent exiting[root@localhost bin]# pstree -p | grep mongod |-mongod(4489)-+-{mongod}(4490) | |-{mongod}(4491) | |-{mongod}(4492) | |-{mongod}(4493) | |-{mongod}(4494) | |-{mongod}(4495) | |-{mongod}(4496) | |-{mongod}(4497) | `-{mongod}(4498)[root@localhost bin]# vi /etc/rc.local[root@localhost bin]# cat /etc/rc.local#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork[root@localhost bin]# ps -ef | grep mongodroot 4489 1 0 08:06 ? 00:00:03 ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --forkroot 18469 4413 0 08:15 pts/1 00:00:00 grep mongod[root@localhost bin]# kill -9 4489[root@localhost bin]# ps -ef | grep mongodroot 18474 4413 0 08:16 pts/1 00:00:00 grep mongod[root@localhost bin]# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork2014-04-27T08:16:24.524+08002014-04-27T08:16:24.524+0800 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.2014-04-27T08:16:24.524+0800about to fork child process, waiting until server is ready for connections.forked process: 18478ERROR: child process failed, exited with error number 100[root@localhost bin]# ps -ef | grep mongod root 18483 4413 0 08:16 pts/1 00:00:00 grep mongod
[root@localhost bin]# cd ../[root@localhost mongodb]# cd data/[root@localhost data]# lslocal.0 local.ns mongod.lock _tmp[root@localhost data]# rm -rf mongod.lock[root@localhost data]# cd ../[root@localhost mongodb]# cd bin[root@localhost bin]# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork2014-04-27T08:18:31.190+08002014-04-27T08:18:31.190+0800 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.2014-04-27T08:18:31.190+0800about to fork child process, waiting until server is ready for connections.forked process: 18493child process started successfully, parent exiting[root@localhost bin]# ps -ef | grep mongod root 18493 1 0 08:18 ? 00:00:00 ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --forkroot 18505 4413 0 08:18 pts/1 00:00:00 grep mongod[root@localhost bin]#