日期:2014-05-16  浏览次数:20461 次

MongoDB试用记录

MongoDB试用记录

MongoDB是一种著名的NoSQL数据库。

操作系统:RHEL5.4

MongoDB版本:2.0.0

?

下载MonoDB并解压

[root@sunrise16 setup]# wget "http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.0.tgz"
--2011-10-20 12:56:36--? http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.0.tgz
正在解析主机 fastdl.mongodb.org... 216.137.45.220, 216.137.45.22, 216.137.45.29, ...
Connecting to fastdl.mongodb.org|216.137.45.220|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:37949452 (36M) [application/x-tar]
Saving to: `mongodb-linux-i686-2.0.0.tgz'

100%[==========================================================================================>] 37,949,452? 44.6K/s?? in 8m 6s??

2011-10-20 13:04:44 (76.2 KB/s) - `mongodb-linux-i686-2.0.0.tgz' saved [37949452/37949452]

[root@sunrise16 setup]#

?

[root@sunrise16 setup]# tar zxf mongodb-linux-i686-2.0.0.tgz
[root@sunrise16 setup]# cd mongodb-linux-i686-2.0.0
[root@sunrise16 mongodb-linux-i686-2.0.0]# ls
bin? GNU-AGPL-3.0? README? THIRD-PARTY-NOTICES
[root@sunrise16 mongodb-linux-i686-2.0.0]# cd bin
[root@sunrise16 bin]# ls
bsondump? mongo? mongod? mongodump? mongoexport? mongofiles? mongoimport? mongorestore? mongos? mongosniff? mongostat? mongotop

?

启动mongod

[root@sunrise16 bin]# ./mongod
./mongod --help for help and startup options
Thu Oct 20 13:05:23
Thu Oct 20 13:05:23 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Thu Oct 20 13:05:23
Thu Oct 20 13:05:23 [initandlisten] MongoDB starting : pid=29178 port=27017 dbpath=/data/db/ 32-bit host=sunrise16
Thu Oct 20 13:05:23 [initandlisten]
Thu Oct 20 13:05:23 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Oct 20 13:05:23 [initandlisten] **?????? see http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Oct 20 13:05:23 [initandlisten] **?????? with --journal, the limit is lower
Thu Oct 20 13:05:23 [initandlisten]
Thu Oct 20 13:05:23 [initandlisten] db version v2.0.0, pdfile version 4.5
Thu Oct 20 13:05:23 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Thu Oct 20 13:05:23 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Thu Oct 20 13:05:23 [initandlisten] options: {}
Thu Oct 20 13:05:23 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Thu Oct 20 13:05:23 dbexit:
Thu Oct 20 13:05:23 [initandlisten] shutdown: going to close listening sockets...
Thu Oct 20 13:05:23 [initandlisten] shutdown: going to flush diaglog...
Thu Oct 20 13:05:23 [initandlisten] shutdown: going to close sockets...
Thu Oct 20 13:05:23 [initandlisten] shutdown: waiting for fs preallocator...
Thu Oct 20 13:05:23 [initandlisten] shutdown: closing all files...
Thu Oct 20 13:05:23 [initandlisten] closeAllFiles() finished
Thu Oct 20 13:05:23 dbexit: really exiting now
[root@sunrise16 bin]#

根据屏幕上输出的信息,克制没有创建/data/db/目录。

?

[root@sunrise16 bin]# mkdir -p /data/db/
[root@sunrise16 bin]# ./mongod?????????
./mongod --help for help and startup options
Thu Oct 20 13:06:31
Thu Oct 20 13:06:31 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want