首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NoMatchingDocument:在local.system.replset中找不到副本集配置文档

NoMatchingDocument:在local.system.replset中找不到副本集配置文档
EN

Stack Overflow用户
提问于 2019-10-11 17:26:21
回答 2查看 3K关注 0票数 4

我在我的AWS EC2实例中有一个独立的MongoDB实例。我打算把它换成Mongo Atlas。前提条件是将MongoDB实例转换为副本集。

下面是我的mongo.conf文件的代码:

代码语言:javascript
复制
# mongodb.conf

# Where to store the data.
dbpath=/opt/bitnami/mongodb/data/db

#where to log
logpath=/opt/bitnami/mongodb/log/mongodb.log

logappend=true

bind_ip = 127.0.0.1
port = 27017

# Enable journaling, http://www.mongodb.org/display/DOCS/Journaling
journal=true


# Enable smaller default file size for MongoDB
# Also reduces size of journal files from 1G to 128M
#smallfiles=true

# Enables periodic logging of CPU utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true
auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#oplog = 0

# Diagnostic/debugging option
#nocursors = true

# Ignore query hints
#nohints = true



setParameter = enableLocalhostAuthBypass=0


unixSocketPrefix=/opt/bitnami/mongodb/tmp
fork = true

setParameter = enableLocalhostAuthBypass=0




# Replication Options

replication:
    replSetName: res0

# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com

我使用下面的命令来创建副本集:

代码语言:javascript
复制
 sudo mongod --port 27017 --dbpath /opt/bitnami/mongodb --replSet res0 --bind_ip localhost

我得到以下错误:

代码语言:javascript
复制
NoMatchingDocument: Did not find replica set configuration document in local.system.replset

我还应该在mongo.conf文件中更改哪些内容?

EN

回答 2

Stack Overflow用户

发布于 2020-07-01 16:59:18

我也有同样的问题,但我解决了以下步骤:

我在Windows服务器上。Mongo DB shell版本3.0.4。下面的屏幕截图中的错误与您提到的相同

所以我将Mongo shell交换机连接到本地。

使用以下命令。请注意,SIR是我的副本集名称

代码语言:javascript
复制
    cfg = {  _id:"SIR" , members:
                 [{ _id:0,host:"localhost:27017"}] 
    
           };

   rs.initiate(cfg)

结果

票数 2
EN

Stack Overflow用户

发布于 2021-03-23 23:12:53

我正在使用bitnami/mongodb helm chart将mongodb部署到我们的自定义k8s集群,因为在默认情况下它是cluster.local,并且导致在主机地址中使用错误的集群域运行mongodb,所以忘记覆盖values.yaml文件中的clusterDomain变量时会出现这个错误:

代码语言:javascript
复制
mongodb 14:59:37.35 WARN ==> Problem initiating replica set
request: rs.initiate({"_id":"rs0", "members":[{"_id":0,"host":"temp-mongo-0.temp-mongo-headless.default.svc.**cluster.local**:27017","priority":5}]})
response: MongoDB shell version v4.4.4
connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("dc48d2bc-269b-4710-95b8-525b7768fa72") }
MongoDB server version: 4.4.4
{
"ok" : 0,
"errmsg" : "No host described in new configuration with {version: 1, term: 0} for replica set rs0 maps to this node",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}
bye
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58338218

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档