centos6.5安装mongodb2.6
下载地址:http://www.mongodb.org/downloads解压命令: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
root@10.187.50.3's password:
# cd /home/xyz/Desktop
# ls
mongodb-linux-i686-2.6.0mongodb-linux-i686-2.6.0.tgzvsftpd.rpm
# cdmongodb-linux-i686-2.6.0
# ls
binGNU-AGPL-3.0READMETHIRD-PARTY-NOTICES
# rsync -a bin /usr/local/mongodb
# cd /usr/local/
# ls
binetcgamesincludeliblibexecmongodbsbinsharesrc
# cd mongodb
# ls
bin
# cd bin
# ls
bsondumpmongodump mongoimportmongorestoremongotop
mongo mongoexportmongooplog mongos
mongod mongofiles mongoperf mongostat
# cd ../
# ls
bin
# mkdir data
# touch dblogs
# ls
bindatadblogs
# cd bin/
# ls
bsondumpmongodump mongoimportmongorestoremongotop
mongo mongoexportmongooplog mongos
mongod mongofiles mongoperf mongostat
# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
2014-04-27T08:06:43.480+0800
2014-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+0800
about to fork child process, waiting until server is ready for connections.
forked process: 4489
child process started successfully, parent exiting
# pstree -p | grep mongod
|-mongod(4489)-+-{mongod}(4490)
| |-{mongod}(4491)
| |-{mongod}(4492)
| |-{mongod}(4493)
| |-{mongod}(4494)
| |-{mongod}(4495)
| |-{mongod}(4496)
| |-{mongod}(4497)
| `-{mongod}(4498)
# vi /etc/rc.local
# 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
# ps -ef | grep mongod
root 4489 10 08:06 ? 00:00:03 ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
root 1846944130 08:15 pts/1 00:00:00 grep mongod
# kill -9 4489
# ps -ef | grep mongod
root 1847444130 08:16 pts/1 00:00:00 grep mongod
# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
2014-04-27T08:16:24.524+0800
2014-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+0800
about to fork child process, waiting until server is ready for connections.
forked process: 18478
ERROR: child process failed, exited with error number 100
# ps -ef | grep mongod root 1848344130 08:16 pts/1 00:00:00 grep mongod
# cd ../
# cd data/
# ls
local.0local.nsmongod.lock_tmp
# rm -rf mongod.lock
# cd ../
# cd bin
# ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
2014-04-27T08:18:31.190+0800
2014-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+0800
about to fork child process, waiting until server is ready for connections.
forked process: 18493
child process started successfully, parent exiting
# ps -ef | grep mongod root 18493 10 08:18 ? 00:00:00 ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
root 1850544130 08:18 pts/1 00:00:00 grep mongod
#
页:
[1]