[英]MongoDB enable oplog windows
Try to enable oplog locally尝试在本地启用oplog
Add to C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg
添加到
C:\\Program Files\\MongoDB\\Server\\4.2\\bin\\mongod.cfg
replication:
replSetName: rs0
oplogSizeMB: 100
Restart mongod, but local.oplog does not exist重启mongod,但是local.oplog不存在
How correctly enable oplog?如何正确启用oplog?
UPD: Use MongoDB 4.2, Windows 10 UPD:使用 MongoDB 4.2,Windows 10
Add the replication configs in the mongod.cfg
file.在
mongod.cfg
文件中添加复制配置。
Restart MongoDB from services.从服务重启 MongoDB。
Open MongoDB from a command prompt.从命令提示符打开 MongoDB。
Execute the following command in the mongo terminal:在 mongo 终端中执行以下命令:
rs.initiate({_id:"rs0", members: [{"_id":1, "host":"127.0.0.1:27017"}]})
After that you'll see something like this:之后你会看到这样的东西:
{ "info" : "Config now saved locally. Should come online in about a minute.", "ok" : 1 }
Switch to the local database using use local
.使用
use local
切换到本地数据库。
You can verify oplog.rs
by viewing the collections using: show collections
您可以使用以下
oplog.rs
查看集合来验证oplog.rs
show collections
You'll see that oplog.rs
will be listed along with other collections.您将看到
oplog.rs
将与其他集合一起列出。
oplog.rs
replset.election
replset.minvalid
replset.oplogTruncateAfterPoint
startup_log
system.replset
system.rollback.id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.