Mongodb,分片和多个Windows服务 [英] Mongodb, sharding and multiple windows services
问题描述
为了使分片工作,我需要运行mongod.exe的两个副本.一台作为分片,一台作为配置服务器.如何将两个mongod实例都安装为Windows服务?
In order to get sharding to work I need to run two copies of mongod.exe. One as a shard and one as the config server. How can I install both mongod instances as windows services?
推荐答案
以下命令行将安装Mongo DB的第二个实例.请注意,您必须提供 serviceName , serviceDisplayName , port , dbpath 和 logpath 为了避免冲突.
The following command line will install a 2nd instance of Mongo DB. Note that you have to provide serviceName, serviceDisplayName, port, dbpath and logpath in order to avoid collisions.
mongod --install --serviceName" Mongo DB 2nd实例" --serviceDisplayName" Mongo DB 2nd instance " --port 37017 --dbpath c:\ data \ db2 --logpath c:\ data \ logs \ mongolog2.txt
mongod --install --serviceName "Mongo DB 2nd instance" --serviceDisplayName "Mongo DB 2nd instance" --port 37017 --dbpath c:\data\db2 --logpath c:\data\logs\mongolog2.txt
然后您只需使用
net start" Mongo DB 2nd实例"
这篇关于Mongodb,分片和多个Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!