wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了无法在Windows上部署MongoDB副本集?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我想从配置文件部署一个 mongodb副本集,其中包含1个主副本和2个副主,如下所示: 主节点的第一个配置文件 #primary node #=============== dbpath = C:\data\rs0\1 directoryperdb = true bind_ip = 192.168.2.104 port = 27017 logpath = C:\mongodb2.5.3\logs\
我想从配置文件部署一个 mongodb副本集,其中包含1个主副本和2个副主,如下所示:

主节点的第一个配置文件

#primary node
#===============
dbpath = C:\data\rs0\1
directoryperdb = true
bind_ip = 192.168.2.104
port = 27017
logpath = C:\mongodb2.5.3\logs\primary.log
logappend = true
noauth = true
replSet = rs0
rest = true

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

#secondary node
#===============
dbpath = C:\data\rs0\2
directoryperdb = true
bind_ip = 192.168.2.104
port = 27018
logpath = C:\mongodb2.5.3\logs\secondary1.log
logappend = true
noauth = true
replSet = rs0
rest = true

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

#secondary node
#===============
dbpath = C:\data\rs0\3
directoryperdb = true
bind_ip = 192.168.2.104
port = 27019
logpath = C:\mongodb2.5.3\logs\secondary2.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: "config\mongorep.conf",dbpath: "C:\data\rs0\1",directoryperdb: true,logappend: true,logpath: "C:\mongodb2.5.3\logs\primary.log",noauth: true,port: 27017,replSet: "rs0",rest: true }
2013-11-28T16:26:59.742+0700 [FileAllocator] allocating new datafile C:\data\rs0\1\local\local.ns,filling with zeroes...
2013-11-28T16:26:59.742+0700 [FileAllocator] creating directory C:\data\rs0\1\local\_tmp
2013-11-28T16:26:59.835+0700 [FileAllocator] done allocating datafile C:\data\rs0\1\local\local.ns,size: 16MB,took 0.092 secs
2013-11-28T16:26:59.836+0700 [FileAllocator] allocating new datafile C:\data\rs0\1\local\local.0,filling with zeroes...
2013-11-28T16:27:00.101+0700 [FileAllocator] done allocating datafile C:\data\rs0\1\local\local.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().

大佬总结

以上是大佬教程为你收集整理的无法在Windows上部署MongoDB副本集?全部内容,希望文章能够帮你解决无法在Windows上部署MongoDB副本集?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: