【MongoDB】Configure a Windows Service for MongoDB,mongodbconfigure
In this blog, I will mainly attach great importantance to how to create a windows service for mongodb. The method described in the next is referred from the official website of mongodb.
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
- First of all, create the folder and files that need to store db and log. if you forgot, you could view the above the blog. In my local machine,
- create a configuration file
- create the mongodb service. use the following command. and use command ’net start mongodb ‘ to start the service.
in the meantime, we could use anther way to start service.
- use the command { net stop mongoDB} to stop this server or in the above service window.
这个问题我也遇到过,以管理员身份运行cmd,然后再执行以上命令就OK了。
在启动Linux上的mongodb时使用master参数,在windows上启动时使用slave参数试试。
不过官方文档推荐2.4以后都使用replica set,不要再使用主从复制了。
使用replica set需要3个以上的节点,可以设置两个或以上的数据节点,多个选举节点,节点数要是基数个,哪个节点时primary由系统自己决定就好。
没有试过在Linux和windows上同时打开mongodb。
开启mongodb的参数可以参考这里:
docs.mongodb.org/...tions/
主从复制信息参考这里:
docs.mongodb.org/manual/core/master-slave/
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。