如何在MongoDB新版本(6.0以上)的Windows中创建副本集。

huangapple go评论64阅读模式
英文:

How to create replica set in mongoDb new version above 6.0 in windows

问题

如何在MongoDB(Node.js)的最新版本中创建复制集。

我尝试了MongoDB文档
https://www.mongodb.com/docs/manual/tutorial/convert-standalone-to-replica-set/

我使用以下命令将实例运行为复制集:

mongod --port 27017 --replSet rs0 --dbpath="C:\data\db0"

然后在mongosh中运行rs.initiate()命令,但出现错误,提示找不到复制集。

英文:

how to create replication in mongoDb (node js) in latest version.

i was trying mongodb documentation
https://www.mongodb.com/docs/manual/tutorial/convert-standalone-to-replica-set/

i used this command to run instance as replication:

mongod --port 27017 --replSet rs0 --dbpath="C:\data\db0"

then in mongosh

run rs.initiate() command and getting error as replica set not found

答案1

得分: 1

下载最新版本的mongosh,并在mongo shell中尝试运行以下命令:

rs.initiate();
rs.conf();
英文:

Download mongosh new version and in mongo shell try to run these commands

rs.initiate();
rs.conf();

huangapple
  • 本文由 发表于 2023年1月6日 17:50:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75029349.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定