0

When I use mongodb, I have to perform two steps to start mongodb.

  1. start the mongod then pass dbpath
  2. then apply mongo command

But instead of that, is there any other way to ignore this step?

Community
  • 1
  • 1
Maulik Patel
  • 2,742
  • 4
  • 19
  • 28
  • 1
    possible duplicate of [How to run MongoDB as windows service?](http://stackoverflow.com/questions/2438055/how-to-run-mongodb-as-windows-service) – Luke Peterson Jul 05 '14 at 07:09
  • How to configure your database falls outside of the scope of SO and would be better asked on SuperUser or ServerFault. On the other hand, just looking at the [official mongodb guides](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#configure-a-windows-service-for-mongodb) would be an awesome start for you. – Karl-Johan Sjögren Jul 06 '14 at 11:39

2 Answers2

1

The duplicate question that has been suggested links to mostly outdated answers.

If you install MongoDB 2.6.1 or newer using the MSI download and an Administrator Command Prompt, a service definition should automatically be created for you.

The MongoDB documentation also has a tutorial to help you Manually Create a Windows Service definition if needed.

Community
  • 1
  • 1
Stennie
  • 63,885
  • 14
  • 149
  • 175
  • I just installed 2.6.3 on Windows 8.1 using the MSI download and it didn't create the service for me. At least I couldn't find it in the Services list. – JohnnyHK Jul 06 '14 at 01:30
  • @JohnnyHK: Just retested; the service creation wants an [Administrator Command Prompt](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#open-an-administrator-command-prompt), otherwise it rather silently fails to create the service. The expected outcome would be for the installer to prompt for admin access if required (or warn explicitly). I'll find or raise a Jira issue to fix this. – Stennie Jul 07 '14 at 01:11
  • Relevant Jira issue is [SERVER-14263: Installer should install MongoDB as a service on Windows](https://jira.mongodb.org/browse/SERVER-14263). – Stennie Jul 07 '14 at 01:15
0

Why do you need a step 2?

It only launches a mongo client with a user console to connect to the running mongo db process. If you create a linux or windows service don't call mongo

BTW there is such a question already in stack overflow here

Community
  • 1
  • 1
Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97