How to install MongoDB as a system service under Windows _mongodb

Source: Internet
Author: User
Tags auth install mongodb mongodb

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.