运行mongod的多个实例作为服务 [英] running multiple instance of mongod as service

查看:106
本文介绍了运行mongod的多个实例作为服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试启动多个MongoDB即服务实例.在命令行下,我可以启动多个Mongo实例,对于第一个实例,我在命令后附加"--install",现在它作为服务运行.但是现在我尝试将"--install"附加到第二个实例,并得到一个错误:

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:

第一个命令运行良好:

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

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

但第二个错误:

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

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

错误:

创建服务MongoDB_2.创建服务时出错. Der Name wird bereits als Dienstname oder als Dienstinstanzname verwendet. (1078)

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

我认为MongoDB使用内部服务名称,该名称始终相同,并且与显示的服务名称不同.但是我不知道该如何解决?

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?

有什么建议吗?

问候 雷恩

推荐答案

我遇到了同样的问题.我的解决方法有点怪异,但似乎可以解决问题:

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

  1. 使用monogd --install创建第一个mongod服务
  2. 打开注册表编辑器,然后导航到HKLM \ SYSTEM \ CurrentControlSet \ services \ NameOfMongoService
  3. 导出此密钥
  4. 在文本编辑器中编辑导出的reg文件,更新服务名称和mongod参数.
  5. 导入reg(并可能重新启动).

要使mongos作为服务运行,我采用了另一种方法,并使用了Windows NT资源工具包中的instsrv和srvany:

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

此kb并未提及在使用instsrv安装srvany之后,您必须在注册表中新创建的服务下添加Parameters子项.该密钥应包含一个名为"Application"的REG_SZ,并带有要作为服务启动的应用程序的路径.

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.

这篇关于运行mongod的多个实例作为服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆