[iyunv@localhost mongodb]# mongod --dbpath data
bash: mongod: command not found
[iyunv@localhost mongodb]# ./mongod --dbpath data
Wed Jan 18 11:06:41 [initandlisten] MongoDB starting : pid=8859 port=27017 dbpath=data 32-bit
** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** see http://blog.mongodb.org/post/137788967/32-bit-limitations
** with --dur, the limit is lower
Wed Jan 18 11:06:41 [initandlisten] db version v1.8.1, pdfile version 4.5
Wed Jan 18 11:06:41 [initandlisten] git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04
Wed Jan 18 11:06:41 [initandlisten] build sys info: Linux bs-linux32.10gen.cc 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Wed Jan 18 11:06:41 [initandlisten] waiting for connections on port 27017
Wed Jan 18 11:06:41 [websvr] web admin interface listening on port 28017
Wed Jan 18 11:06:59 [initandlisten] connection accepted from 127.0.0.1:55098 #1
Wed Jan 18 11:11:05 [initandlisten] connection accepted from 127.0.0.1:40233 #2
Wed Jan 18 11:11:05 [conn2] end connection 127.0.0.1:40233
Wed Jan 18 11:11:05 [initandlisten] connection accepted from 127.0.0.1:40234 #3
Wed Jan 18 11:11:05 [conn3] end connection 127.0.0.1:40234
接着,运行MongoDB数据库客户端(可以使用javascript shell的那玩意儿)。
[iyunv@localhost mongodb]# ls
bsondump mongo mongofiles mongosniff
data mongod mongoimport mongostat
GNU-AGPL-3.0 mongodump mongorestore README
log mongoexport mongos THIRD-PARTY-NOTICES
[iyunv@localhost mongodb]# ./mongo
MongoDB shell version: 1.8.1
connecting to: test
> show dbs
admin (empty)
local (empty)
最后,我们还是在浏览器上玩玩 http://localhost:27017/
You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number。
好了就是这些了!