Summarize how to install MongoDB as a WinXP system service.
The commands used are as follows:
Copy Code code as follows:
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\administrator>mongod-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\mongo\mongodb\ Mongo\logs\mongodb.log--auth--install
All output Going To:c:\mongo\mongodb\mongo\logs\mongodb.log
But cannot connect:
Copy Code code as follows:
C:\Documents and Settings\administrator>mongo
MongoDB Shell version:2.0.1
Connecting To:test
Tue 18:07:50 error:couldn ' t connect to server 127.0.0.1 Shell/mongo.js:8
4
Exception:connect failed
Look at the log, you also need to use the net start MongoDB command to start the service, the log is as follows:
Copy Code code as follows:
Creating Service MongoDB.
Service creation successful.
Service can is started from the command line via ' net start ' MongoDB '.
Tue May 18:06:43 Dbexit:
Tue 18:06:43 shutdown:going to close listening sockets ...
Tue 18:06:43 shutdown:going to flush Diaglog ...
Tue 18:06:43 shutdown:going to close sockets ...
Tue may 18:06:43 shutdown:waiting for FS preallocator ...
Tue 18:06:43 shutdown:closing All Files ...
Tue may 18:06:43 Closeallfiles () finished
Tue 18:06:43 dbexit:really exiting now
Follow the prompts to run net start MongoDB under cmd
Copy Code code as follows:
net start "MongoDB"
C:\Documents and Settings\administrator>net start MongoDB
A system error 2 occurred.
The system could not find the specified file.
Check out the services you just installed through the Control Panel – Management tools – service:
Somehow the path to the Mongod command becomes C:\Documents and settings\administrator\, as follows:
Copy Code code as follows:
"C:\Documents and Settings\administrator\mongod"-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\mongo\mongodb\ Mongo\logs\mongodb.log--auth--service
Specify a good Mongod path and reinstall:
Copy Code code as follows:
C:\mongo\mongodb\mongo\bin>c:\mongo\mongodb\mongo\bin\mongod-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\ Mongo\mongodb\mongo\logs\mongodb.log--auth--install
All output Going To:c:\mongo\mongodb\mongo\logs\mongodb.log
The launch was successful.