When MongoDB is installed and configured for WINDOWS Services, version 1.x. x does not have serviceName. solution 1. x. xservicename
Let's talk about the problems and solutions encountered during mongodb installation. If you encounter the same problems, you can make a reference.
I installed version 1.3.5 (later I tried 1.4.2)
An ERROR occurred while configuring the Windows service. Print ERROR: unknown option serviceName. Then, the MongoDB option cannot be found in the service. If you execute net start MongoDB, you cannot execute it.
Finally, the correct installation and configuration methods are found in the official documentation (Pay attention to the installation of msi on the official website. You need to download msi. My website is zip.)
I. Version Download
This is not much to be said. The address is given for each requirement.
Ii. Installation
1. decompress the zip file directly to the root directory of the D Drive and change the folder name to mongodb (this name is random ). In this case, the main folder is the \ bin folder, which contains several exe files and the important ones are:
Server mongod.exeRouter mongos.exeClient mongo.exe
2,What you need to do is, Create a new data folder under D: \ mongodb, a new log and db folder under data, and a new file named mongo under log. log. In short, you have to create a place to store data and a place to store logs.
D: \ mongodb \ data \ db
D: \ mongodb \ data \ log \ mongo. log
3. Create mongo. config under D: \ mongodb and copy the following two lines:
logpath= D:mongodb\data\log\mongo.logdbpath= D:mongodb\data\db
4. Everything is ready. Open the cmd console as the administrator (do not know how to open Baidu), go to the D: \ mongodb \ bin \ path, and enter:
sc.exe create MongoDB binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\mongo.config\"" DisplayName= "MongoDB" start= "auto"
If everything goes well, the console prints [SC]: CreateService succeeded. If it fails, check the path and check whether the path in the configuration file is correct.
5. Start
Two methods:
(1) Enter
Net start MongoDB (Enabled) net stop MongoDB (disabled)
(2) Enter services. msc in the console, open the service, find MongoDB, and click Start, and set automatic. It will be automatically started next time.
Iii. Uninstall
Enter SC delete MongoDB in the console.