mongodb之rpm包安装(二)

2015-02-25 21:42:10 · 作者: · 浏览: 74
096 2月 2 15:16 _tmp

8
配置开机启动
chkconfig mongod on

9
命令行进入测试
[root@host2 ~]# mongo
MongoDB shell version: 2.6.7
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 dbs
admin (empty)
local 0.078GB
> db.version();
2.6.7
>
>
> help
db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db help
help keys key shortcuts
help misc misc things to know
help mr mapreduce

show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line eva luated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
>
> exit
bye
[root@host2 ~]#

10
停止
sudo service mongod stop

可以通过日志文件 /var/log/mongodb/mongod.log查看mongod进程的错误和相关信息。