如何确定Mongo数据库所属的副本集

时间:2016-02-11 13:03:46

标签: mongodb

如果我有一个副本设置了一个名为davesReplSet的运行,我关闭了我的计算机并返回并启动了一个与复制集中dbpath匹配的Mongo实例我得到一个警告:

** WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset
**          Restart with --replSet unless you are doing maintenance and  no other clients are connected.
**          The TTL collection monitor will not start because of this.
**

如何确定该集的正确名称是什么?或者它正在运行的副本集?

1 个答案:

答案 0 :(得分:1)

您可以使用shell

连接到此实例
mongo <host>:<port>/local

然后,您可以访问system.replset集合并通过发出以下内容查找副本集:

> use local
> db.system.replset.find({},{_id:1})
{ "_id" : "myReplSet" }