博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos6.5安装mongodb2.6
阅读量:5101 次
发布时间:2019-06-13

本文共 4420 字,大约阅读时间需要 14 分钟。

下载地址:

解压命令: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]# ls
mongodb-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]# ls
bin  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]# ls
bin  etc  games  include  lib  libexec  mongodb  sbin  share  src
[root@localhost local]# cd mongodb
[root@localhost mongodb]# ls
bin
[root@localhost mongodb]# cd bin
[root@localhost bin]# ls
bsondump  mongodump    mongoimport  mongorestore  mongotop
mongo     mongoexport  mongooplog   mongos
mongod    mongofiles   mongoperf    mongostat
[root@localhost bin]# cd ../
[root@localhost mongodb]# ls
bin
[root@localhost mongodb]# mkdir data
[root@localhost mongodb]# touch dblogs
[root@localhost mongodb]# ls
bin  data  dblogs
[root@localhost mongodb]# cd bin/
[root@localhost bin]# ls
bsondump  mongodump    mongoimport  mongorestore  mongotop
mongo     mongoexport  mongooplog   mongos
mongod    mongofiles   mongoperf    mongostat
[root@localhost bin]# ./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
[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 mongod
root      4489     1  0 08:06 ?        00:00:03 ./mongod --dbpath=/usr/local/mongodb/data/ --logpath=/usr/local/mongodb/dblogs --fork
root     18469  4413  0 08:15 pts/1    00:00:00 grep mongod
[root@localhost bin]# kill -9 4489
[root@localhost bin]# ps -ef | grep mongod
root     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 --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
[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]# ls
local.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 --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
[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 --fork
root     18505  4413  0 08:18 pts/1    00:00:00 grep mongod
[root@localhost bin]#

转载于:https://www.cnblogs.com/zxlovenet/p/3693183.html

你可能感兴趣的文章
Python 3.5 补充
查看>>
lua 元表
查看>>
软件异常测试
查看>>
ntp -q 输出说明
查看>>
SQL 参数,传入参数和自己申明参数——异常抛出
查看>>
关于搜索引擎的几大核心算法浅析
查看>>
BZOJ 3159: 决战 解题报告
查看>>
[费用流][动态开边] 洛谷 P2050 美食节
查看>>
参数类型 (@Service层) interface 常用参数类型举例
查看>>
react页面跳转 window.location.href和window.open的几种用法和区别
查看>>
centos安装mysql5.6的正确姿态
查看>>
左值和右值
查看>>
10大java开元中文分词器
查看>>
type命令
查看>>
【转】字典转模型需要注意的问题,以及第三方框架来处理字典转模型
查看>>
window.close不提示网页正在关闭的代码
查看>>
java手动加载jar
查看>>
搭建FTP服务
查看>>
模块的导入和使用
查看>>
[AlwaysOn Availability Groups]AlwaysOn健康诊断日志
查看>>