- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在研究 MongoDBUniversity的M101P:面向开发人员的 MongoDB 类(class)。
我在 MongoDB 3.2 上使用 WiredTiger。
我目前的主题是副本集。
类(class)要求我使用以下代码创建一个副本集:
mongod --replSet rs1 --logpath "1.log" --dbpath /data/rs1 --port 27017 --fork
但我使用的是 Windows,它不支持 fork
,所以使用 this要点(根据类(class)管理员的建议)我在创建目录后(运行 mongod)在 3 个不同的控制台中同时运行这些行:
mongod --replSet rs1 --logpath "1.log" --dbpath rs1 --port 27018 --smallfiles --oplogSize64
mongod --replSet rs1 --logpath "2.log" --dbpath rs2 --port 27019 --smallfiles --oplogSize64
mongod --replSet rs1 --logpath "3.log" --dbpath rs3 --port 27020 --smallfiles --oplogSize64
似乎一切正常;我可以看到目录已经填满,日志文件都显示“等待连接”和相关端口号。
最后,我运行以下代码将服务器统一为一个副本集:
config = {_id: "rs1", members: [
{ _id: 0, host: "localhost:27018"},
{ _id: 1, host: "localhost:27019"},
{ _id: 2, host: "localhost:27020"}
]
}
rs.initiate(config)
rs.status()
哪个是 throw :
"errmsg" : "This node was not started with the replSet option",
"code" : 76
我无法理解,因为我已经清楚地为每个服务器使用了 --replSet
选项,并且确实提供了在配置文件中使用的相同 replSet 名称。
我看过关于这个主题的其他问题,但很少,而且没有一个是我能找到地址并为我解决这个问题的。 This一个陈述从错误中看起来很明显:我的配置文件应该包括 --replSet=rs1
,但是从阅读 documentation给我的印象是我定义的配置的 _id
用于此目的:
_id
Type: stringThe name of the replica set. Once set, you cannot change the name of a replica set.
_id must be identical to the replication.replSetName or the value of –replSet specified to mongod on the command line.
此外,在类(class) Material 视频演示中清楚地显示了它以我尝试使用它的方式正确运行。
我已无计可施,非常感谢您的帮助。
jack
最佳答案
所以当我写完这个问题时,答案就像一个灯泡一样出现在我的脑海中,这似乎经常发生......但是这次我想我会把答案留给那些为此苦苦挣扎的人,考虑到论坛上缺少关于此主题的问题/答案。
这是运行我的配置文件时使用默认端口的简单案例。
我用的是 mongo < init_replica.js
运行我的配置并统一服务器以创建副本集。
只需添加一个有效服务器使用的端口,它就可以正确运行:
mongo --port 27020 < init_replica.js
我很遗憾,但我希望这能帮助那些也在学习这门类(class)但发现自己陷入类似困境的人。
jack
关于mongodb - "This node was not started with the replSet option",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40711829/
我尝试在 Ubuntu 14.04 x64 上设置副本集。我在尝试时遇到的第一个错误 $ sudo mongod --port 27017 --replSet rs0: replSet can't g
我正在使用MongoDB worker role project在 Azure 上使用 MongoDB。我有两个独立的云服务,其中一个一切正常,但在另一个中,MongoDB 辅助角色陷入 Busy (
我想试试 mongodb 副本集。我按照《MongoDB:权威指南》的步骤。 $ mongo --nodb 然后在 mongo shell 中: replicaSet = new ReplicaSet
我正在我的本地主机上设置一个副本集,只是为了练习使用必要的命令。我在家里和工作中都这样做。在家里,rs.initiate() 命令运行大约需要三秒钟,而 rs.status() 又需要大约两三分钟才能
首先我知道this与我的标题相同,但就我而言,它不是错误的端口。 我想在我的本地机器上设置分片,我从以下命令开始: mongod --shardsvr --replSet rs1 --port 270
我正在尝试使用以下docker-compose文件创建在本地运行的Mongo ReplicaSet: version: '2.0' services: db01: image: mongo
我做了一个 MongoDB 作业并按照步骤操作,但我遇到了问题“服务器未使用 replset 运行” 我做的步骤是: `"start mongod --replSet m101 --logpath 1
我正在研究 MongoDBUniversity的M101P:面向开发人员的 MongoDB 类(class)。 我在 MongoDB 3.2 上使用 WiredTiger。 我目前的主题是副本集。 类
我有 2 个节点(节点 0、节点 1)的 mongodb 复制集,有一天其中一个节点(节点 1)崩溃。 考虑到删除node1的所有数据再重启需要很长时间,我关闭node0,rsync数据到node1
我正在 Windows 环境中的本地系统上创建副本集按照以下步骤 mkdir -p \srv\mongodb\rs0-0 \srv\mongodb\rs0-1 \srv\mongodb\rs0-2 m
我有一个三节点的 MongoDB 副本集。 如果我通过命令行写入主节点,它会很快完成( 45 秒)! 我在日志中没有看到任何异常——只是成功的连接。 数据最终显示出来,但每个节点的连接都阻塞了。 示例
Node 、 Mongoose 我尝试连接到 mongolab。 mongoose.main_conn = mongoose.createConnection(uriUtil.forma
当我们进行大量并行连接时,我们遇到了 mongodb 套接字关闭的问题。 这是一个测试脚本: var mongodb = require("mongodb"); var async = require
我正在尝试这个: mongod --replSet mySet --dbpath /data/r1 --port 27017 --oplogSize 700 mongod --replSet mySe
我对 mongodb Replset 集有疑问。 主服务器日志消息: 2014-08-14T13:59:45.450+0800 [conn261130] end connection 192.168.
我正在尝试使用此文档在我的 macbook pro 上部署开发/测试复制集。 http://docs.mongodb.org/manual/tutorial/deploy-replica-set/ 我
如何在使用带有选项 server.ssl 的 mongoose 5.2.17 连接到 mongo 后删除此警告。 the server/replset/mongos/db options are de
我的 AWS EC2 实例中有一个独立的 MongoDB 实例。我打算将其转移到 Mongo Atlas。前提是将MongoDB实例转换为副本集。 以下是我的 mongo.conf 的代码文件: #
我想知道如何更改我的 java 代码以支持使用 spring-data 和 MongoDB 的 replset。 我有 3 个 MongoDB 服务器在运行.. 示例: ./mongod --dbpa
我正在 linux 上配置一个 3 节点的 mongodb 副本集。我正在使用以下配置 fork = true bind_ip = 127.0.0.1 port = 27017 verbose = t
我是一名优秀的程序员,十分优秀!