MacOS [rsStart] replSet无法从self或任何种子获取local.system.replset配置(EMPTYCONFIG)

时间:2014-09-19 08:25:05

标签: mongodb

我想尝试mongodb副本集。我按照“MongoDB:The Definitive Guide”的步骤进行操作。

$ mongo --nodb

然后在mongo shell中:

replicaSet = new ReplicaSet({nodes: 3})
replicaSet.startSet()

然后终端重复输出:

[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)

什么'问题?

1 个答案:

答案 0 :(得分:17)

你需要做

rs.initiate()

您也可以尝试这样

replicaSet.startSet();replicaSet.initiate()

http://docs.mongodb.org/manual/reference/method/rs.initiate/

  

启动副本集。 (可选)以包含副本集配置的文档形式获取配置参数。

相关问题