问题描述
我有一台带8Gb RAM的快速Windows 7 PC。我要测试此MongoDB副本集:用于我的开发。不过,我不想购买3台PC,因为它有点贵。是否可以使用某种技术(例如Hyper-V)进行设置?如果没有,我应该购买多少台PC和哪种类型?
I have a fast Windows 7 PC with 8Gb RAM. I want to test this MongoDB replica set: http://www.mongodb.org/display/DOCS/Replica+Sets for my development. I dont want to buy 3 PCs though, as it's kind of expensive. Is there a way to use some kind of technology, like Hyper-V, to be able to set it up? If not, how many PC and what kind should I buy?
推荐答案
您可以在同一台计算机上的不同机器上运行多个mongod进程端口并指向不同的数据目录,并使它们成为同一副本集的一部分。
You can run multiple mongod processes on the same machine on different ports and pointing to different data directories and make them a part of the same replicaset.
mongod --dbpath c:/ data1-端口12345 --replSet foo
mongod --dbpath c:/data1 --port 12345 --replSet foo
mongod --dbpath c:/ data2-端口12346- replSet foo
mongod --dbpath c:/data2 --port 12346 --replSet foo
,然后使用mongo控制台连接到mongod进程之一,并使用此处概述的说明添加启动副本集:
and then connect to one of the mongod processes using the mongo console and add initiate the replica set using instructions outlined here:
这篇关于设置MongoDB副本集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!