加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

无法在Windows上部署MongoDB副本集?

发布时间:2020-12-14 04:38:28 所属栏目:Windows 来源:网络整理
导读:我想从配置文件部署一个 mongodb副本集,其中包含1个主副本和2个副主,如下所示: 主节点的第一个配置文件 #primary node#===============dbpath = C:datars01directoryperdb = truebind_ip = 192.168.2.104port = 27017logpath = C:mongodb2.5.3logspri
我想从配置文件部署一个 mongodb副本集,其中包含1个主副本和2个副主,如下所示:

主节点的第一个配置文件

#primary node
#===============
dbpath = C:datars01
directoryperdb = true
bind_ip = 192.168.2.104
port = 27017
logpath = C:mongodb2.5.3logsprimary.log
logappend = true
noauth = true
replSet = rs0
rest = true

辅助节点的第二个配置文件

#secondary node
#===============
dbpath = C:datars02
directoryperdb = true
bind_ip = 192.168.2.104
port = 27018
logpath = C:mongodb2.5.3logssecondary1.log
logappend = true
noauth = true
replSet = rs0
rest = true

以及辅助节点的第三个配置文件

#secondary node
#===============
dbpath = C:datars03
directoryperdb = true
bind_ip = 192.168.2.104
port = 27019
logpath = C:mongodb2.5.3logssecondary2.log
logappend = true
noauth = true
replSet = rs0
rest = true

但我得到了这个错误

....
    2013-11-28T16:26:59.734+0700 [initandlisten] options: { bind_ip: "192.168.2.104",config: "configmongorep.conf",dbpath: "C:datars01",directoryperdb: true,logappend: true,logpath: "C:mongodb2.5.3logsprimary.log",noauth: true,port: 27017,replSet: "rs0",rest: true }
2013-11-28T16:26:59.742+0700 [FileAllocator] allocating new datafile C:datars01locallocal.ns,filling with zeroes...
2013-11-28T16:26:59.742+0700 [FileAllocator] creating directory C:datars01local_tmp
2013-11-28T16:26:59.835+0700 [FileAllocator] done allocating datafile C:datars01locallocal.ns,size: 16MB,took 0.092 secs
2013-11-28T16:26:59.836+0700 [FileAllocator] allocating new datafile C:datars01locallocal.0,filling with zeroes...
2013-11-28T16:27:00.101+0700 [FileAllocator] done allocating datafile C:datars01locallocal.0,size: 64MB,took 0.265 secs
2013-11-28T16:27:00.102+0700 [initandlisten] command local.$cmd command: { create: "startup_log",size: 10485760,capped: true } ntoreturn:1 keyUpdates:0  reslen:37 360ms
2013-11-28T16:27:00.102+0700 [initandlisten] waiting for connections on port 27017
2013-11-28T16:27:00.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2013-11-28T16:27:00.103+0700 [rsStart] replSet info you may need to run replSetInitiate -- rs.initiate() in the shell -- if that is not already done
2013-11-28T16:27:00.104+0700 [websvr] admin web console waiting for connections on port 28017
2013-11-28T16:27:01.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2013-11-28T16:27:02.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2013-11-28T16:27:03.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2013-11-28T16:27:04.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
2013-11-28T16:27:05.103+0700 [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)

而当我完成相同的指南时
http://docs.mongodb.org/manual/tutorial/deploy-replica-set-for-testing/

我也得到了同样的错误

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

我不知道我需要做什么esle配置来解决这个问题,请帮助我,非常感谢.

解决方法

在配置文件中添加/更改replSet的值后,在mongo控制台中运行rs.initiate().

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读