gpt4 book ai didi

mongodb - NoMatchingDocument : Did not find replica set configuration document in local. system.replset

转载 作者:行者123 更新时间:2023-12-04 15:39:36 24 4
gpt4 key购买 nike

我的 AWS EC2 实例中有一个独立的 MongoDB 实例。我打算将其转移到 Mongo Atlas。前提是将MongoDB实例转换为副本集。

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

# 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

我正在使用以下命令创建副本集:
 sudo mongod --port 27017 --dbpath /opt/bitnami/mongodb --replSet res0 --bind_ip localhost

我收到以下错误:
NoMatchingDocument: Did not find replica set configuration document in local.system.replset

我的 mongo.conf 还有什么我应该改变的文件?

最佳答案

我有同样的问题,但我解决了以下步骤:
我在 Windows 服务器上。 Mongo DB shell 版本 3.0.4 。以下屏幕截图中的错误与您提到的相同
enter image description here
所以我连接到 Mongo shell 切换到 local 。
使用以下命令。请注意 SIR 是我的副本集名称

    cfg = {  _id:"SIR" , members:
[{ _id:0,host:"localhost:27017"}]

};

rs.initiate(cfg)
结果
enter image description here

关于mongodb - NoMatchingDocument : Did not find replica set configuration document in local. system.replset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58338218/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com