kockiren
kockiren

Reputation: 711

running multiple instance of mongod as service

i try to start multiple Instance of MongoDB as a Service. Under the commandline i can start more than one Mongo Instances, for the first instance i append "--install" to the Command and now it run as service. But now i try to append "--install" to the second Instance and get a Error:

first command runs well:

c:\data\bin\mongod --nohttpinterface --port 27201 --dbpath c:\data\cluster\db1 --master --logpath c:\var\log\mongodb_db1.log --serviceName MongoDB_1 --install

but the second one gives a error:

c:\data\bin\mongod --nohttpinterface --port 28000 --dbpath c:\data\cluster\db2 --master --logpath c:\var\log\mongodb_db2.log --serviceName MongoDB_2 --install

error:

Creating service MongoDB_2. Error creating service. Der Name wird bereits als Dienstname oder als Dienstinstanzname verwendet. (1078)

I think that MongoDB use an internal Servicename that is always the same and differ to the shown servicename. But i don't know how to fix it?

Any suggestions?

Regards Rene

Upvotes: 1

Views: 5064

Answers (2)

hemme
hemme

Reputation: 1652

You can do a polite installation of a 2nd instance using the proper command line switches. Just read my answer here https://stackoverflow.com/a/9273816/249992

Upvotes: 4

user426724
user426724

Reputation: 1026

I ran into this same issue. My workaround is kind of hacky, but it seems to work:

  1. Create the first mongod service using monogd --install
  2. Open regedit and navigate to HKLM\SYSTEM\CurrentControlSet\services\NameOfMongoService
  3. Export this key
  4. Edit exported reg file in text editor, updating service name and mongod params.
  5. Import into reg (and possibly reboot).

To get mongos running as a service I took a different approach and used instsrv and srvany from the Windows NT Resource Kit:

http://support.microsoft.com/kb/137890

This kb doesn't mention that after intstalling srvany using instsrv you have to add a Parameters sub-key under the newly created service in the registry. This key should contain a REG_SZ named "Application" with the path to the app to start as a service.

Upvotes: -1

Related Questions