[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 cocould view the above blog. In my local machine,
- Create a configuration file
Create a configuration file, this file can include any of the configuration options for example D, but must include a valid setting for logpath. we can learn from the next picture that echo command promart.
- Create the mongodb service. use the following command. and use command 'net start mongodb 'to start the service.
In the meantime, we cocould use anther way to start service.
- Use the command {net stop mongoDB} to stop this server or in the above service window.
Installing MongoDB as a Windows service fails under Windows 7.
I have also encountered this problem. Run cmd as an administrator and then execute the above command.
How can I configure a MongoDB database on Linux as the master database? In Windows, MongoDB is a slave database?
Use the master parameter when starting mongodb on Linux, and use the slave parameter when starting on windows.
However, we recommend that you use the replica set later than 2.4 in the official documentation. Do not use master-slave replication any more.
Using replica set requires more than three nodes. You can set two or more data nodes and multiple election nodes. If the number of nodes is a base node, the system determines which node should be primary.
I have not tried to enable mongodb on both Linux and windows.
For the parameters for enabling mongodb, refer to here:
Docs.mongodb.org/..tions/
For master-slave replication information, refer to here:
Docs.mongodb.org/manual/core/master-slave/