mongoDB学习笔记

来源:互联网 发布:godaddy域名 七元 编辑:程序博客网 时间:2024/05/20 00:17

1.MongoDB 默认存储数据目录为/data/db/ (或者 c:\data\db), 默认端口27017,默认HTTP 端口28017。


2.MongoDB 也支持同mysql 一样的读取启动配置文件的方式来启动数据库

启动时加上”-f”参数,并指向配置文件即可


3.MongoDB 提供了一种后台Daemon 方式启动的选择,只需加上一个”--fork”参数即可,这就使我们可以更方便的操作数据库的启动,但如果用到了”--fork”参数就必须也启用”--logpath”参数,这是强制的



Start MongoDB

Start the mongod process by issuing the following command (as root, or with sudo):

service mongod start

You can verify that the mongod process has started successfully by checking the contents of the log file at/var/log/mongo/mongod.log.

You may optionally, ensure that MongoDB will start following a system reboot, by issuing the following command (with root privileges:)

chkconfig mongod on

Stop MongoDB

Stop the mongod process by issuing the following command (as root, or with sudo):

service mongod stop

Restart MongoDB

You can restart the mongod process by issuing the following command (as root, or with sudo):

service mongod restart

Follow the state of this process by watching the output in the /var/log/mongo/mongod.log file to watch for errors or important messages from the server.

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/#control-mongodb


原创粉丝点击