启动的过程中弹出防火墙提示框,允许。cmd窗口最后一行看到“waiting for connections”表示mongod.exe已正常工作。这个窗口中还可以看到操作系统是“64-bit”,看到mongodb的版本信息。
数据库启动后I:\mongodb\data下自动创建了journal目录,并创建了mogod.lock文件。journal目录下已经有了一个文件“j._0”了。在cmd窗口中能看到“journal dir=i:/mongodb/data/journal”。这个journal相当于redo,据说对系统性能影响大约5%。为了安全牺牲这5%是值得的,因此,2.0以后的MongoDB版本默认安装都是开启的。我认为这一细节可视为MongoDB奔向成熟的标志。
打开CMD窗口,输入下列指令连接数据库:
i:\mongodb\db\bin\mongo.exe
At the mongo.exe prompt, issue the following two commands to insert a record in the test collection of the default test database and then retrieve that record:
all output going to: i:\mongodb\log\mongo.log. Modify the path to the mongod.cfg file as needed. For the--install option to succeed, you must specify a logpath setting or the --logpath run-time option. (配置logpath是必须的)
运行MongoDB service:
net start MongoDB
注意事项
If you wish to use an>--install operation. You may also specify --dbpathon the command line; however, always prefer the configuration file.
优先使用mongod.cfg中的配置。
If the dbpath directory does not exist, mongod.exe will not be able to start. The default value for dbpath is \data\db.
需手工创建dbpath目录。