Red Hat Enterprise Linux Server release 5.6 安装 MongoDB 2.6.4

1:下载

[jifeng@jifeng04 ~]$ wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
--2014-09-03 12:39:31--  http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
正在解析主机 downloads.mongodb.org... 54.231.10.212
Connecting to downloads.mongodb.org|54.231.10.212|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:115652018 (110M) [application/x-gzip]
Saving to: `mongodb-linux-x86_64-2.6.4.tgz'

100%[==============================================================>] 115,652,018  155K/s   in 22m 19s 

2014-09-03 13:01:51 (84.3 KB/s) - `mongodb-linux-x86_64-2.6.4.tgz' saved [115652018/115652018]

[jifeng@jifeng04 ~]$ ls
Desktop  hadoop  jdk1.7.0_45  mongodb-linux-x86_64-2.6.4.tgz

2:解压

[jifeng@jifeng04 ~]$ tar zxf mongodb-linux-x86_64-2.6.4.tgz 
[jifeng@jifeng04 ~]$ ls
Desktop  hadoop  jdk1.7.0_45  mongodb-linux-x86_64-2.6.4  mongodb-linux-x86_64-2.6.4.tgz

3:配置环境变量

[jifeng@jifeng04 ~]$ cat .bash_profile
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin
export PATH
export JAVA_HOME=$HOME/jdk1.7.0_45
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar


export HADOOP_HOME=$HOME/hadoop/hadoop-1.2.1  
export ANT_HOME=$HOME/apache-ant-1.9.4  
export MONGODB_HOME=$HOME/mongodb-linux-x86_64-2.6.4  
export PATH=$PATH:$ANT_HOME/bin:$HADOOP_HOME/bin:$MONGODB_HOME/bin
[jifeng@jifeng04 ~]$ source .bash_profile

4:验证

[jifeng@jifeng04 ~]$ mongod -version
db version v2.6.4
2014-09-03T14:20:30.547+0800 git version: 3a830be0eb92d772aa855ebb711ac91d658ee910


5:运行

创建数据目录

[jifeng@jifeng04 ~]$ cd mongodb-linux-x86_64-2.6.4
[jifeng@jifeng04 mongodb-linux-x86_64-2.6.4]$ ls
bin  GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES
[jifeng@jifeng04 mongodb-linux-x86_64-2.6.4]$ mkdir data

启动:mongod -dbpath /home/jifeng/mongodb-linux-x86_64-2.6.4/data
<span style="font-family: Arial, Helvetica, sans-serif;">[jifeng@jifeng04 mongodb-linux-x86_64-2.6.4]$ mongod -dbpath /home/jifeng/mongodb-linux-x86_64-2.6.4/data</span>

启动后的提示

2014-09-03T14:23:17.046+0800 [initandlisten] MongoDB starting : pid=15418 port=27017 dbpath=/home/jifeng/mongodb-linux-x86_64-2.6.4/data 64-bit host=jifeng04
2014-09-03T14:23:17.046+0800 [initandlisten] db version v2.6.4
2014-09-03T14:23:17.047+0800 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-03T14:23:17.047+0800 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-03T14:23:17.047+0800 [initandlisten] allocator: tcmalloc
2014-09-03T14:23:17.048+0800 [initandlisten] options: { storage: { dbPath: "/home/jifeng/mongodb-linux-x86_64-2.6.4/data" } }
2014-09-03T14:23:17.052+0800 [initandlisten] journal dir=/home/jifeng/mongodb-linux-x86_64-2.6.4/data/journal
2014-09-03T14:23:17.052+0800 [initandlisten] recover : no journal files present, no recovery needed
2014-09-03T14:23:17.572+0800 [initandlisten] preallocateIsFaster=true 5.7
2014-09-03T14:23:18.044+0800 [initandlisten] preallocateIsFaster=true 7.48
2014-09-03T14:23:19.477+0800 [initandlisten] preallocateIsFaster=true 8.14
2014-09-03T14:23:19.477+0800 [initandlisten] preallocating a journal file /home/jifeng/mongodb-linux-x86_64-2.6.4/data/journal/prealloc.0
2014-09-03T14:23:22.012+0800 [initandlisten]            File Preallocator Progress: 912261120/107374182484%
2014-09-03T14:23:23.949+0800 [initandlisten] preallocating a journal file /home/jifeng/mongodb-linux-x86_64-2.6.4/data/journal/prealloc.1
2014-09-03T14:23:26.009+0800 [initandlisten]            File Preallocator Progress: 650117120/107374182460%
2014-09-03T14:23:28.220+0800 [initandlisten] preallocating a journal file /home/jifeng/mongodb-linux-x86_64-2.6.4/data/journal/prealloc.2
2014-09-03T14:23:31.019+0800 [initandlisten]            File Preallocator Progress: 996147200/1073741824        92%
2014-09-03T14:23:31.937+0800 [FileAllocator] allocating new datafile /home/jifeng/mongodb-linux-x86_64-2.6.4/data/local.ns, filling with zeroes...
2014-09-03T14:23:31.937+0800 [FileAllocator] creating directory /home/jifeng/mongodb-linux-x86_64-2.6.4/data/_tmp
2014-09-03T14:23:32.040+0800 [FileAllocator] done allocating datafile /home/jifeng/mongodb-linux-x86_64-2.6.4/data/local.ns, size: 16MB,  took 0.099 secs
2014-09-03T14:23:32.053+0800 [FileAllocator] allocating new datafile /home/jifeng/mongodb-linux-x86_64-2.6.4/data/local.0, filling with zeroes...
2014-09-03T14:23:32.234+0800 [FileAllocator] done allocating datafile /home/jifeng/mongodb-linux-x86_64-2.6.4/data/local.0, size: 64MB,  took 0.18 secs
2014-09-03T14:23:32.258+0800 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2014-09-03T14:23:32.260+0800 [initandlisten]     added index to empty collection
2014-09-03T14:23:32.263+0800 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0  reslen:37 328ms
2014-09-03T14:23:32.264+0800 [initandlisten] waiting for connections on port 27017



6:客户端连接

[jifeng@jifeng04 ~]$ mongo
MongoDB shell version: 2.6.4
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
> show databases;show databases;
admin  (empty)
local  0.078GB

服务端的变化:

2014-09-03T14:24:05.853+0800 [initandlisten] connection accepted from 127.0.0.1:51719 #1 (1 connection now open)
2014-09-03T14:24:31.912+0800 [PeriodicTaskRunner] task: WriteBackManager::cleaner took: 34ms
2014-09-03T14:24:31.913+0800 [clientcursormon] mem (MB) res:36 virt:416
2014-09-03T14:24:31.913+0800 [clientcursormon]  mapped (incl journal view):160
2014-09-03T14:24:31.913+0800 [clientcursormon]  connections:1
2014-09-03T14:29:32.033+0800 [clientcursormon] mem (MB) res:36 virt:416
2014-09-03T14:29:32.034+0800 [clientcursormon]  mapped (incl journal view):160
2014-09-03T14:29:32.034+0800 [clientcursormon]  connections:1




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值