副本集错误代码76 [英] Replica Set Error Code 76

查看:339
本文介绍了副本集错误代码76的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试按El Capitano的讲师所示(仅用于单机)尝试创建mongo dba课程的副本集时,出现以下错误.我有三个成员:

In ref to mongo dba course trying to create replica set as asked shown by instructor in El Capitano (Single machine only), I get following error. I have three members:

(使用自制软件安装了mongodb)

(mongodb was installed using homebrew)

第一步:设置配置 cfg = {_id:"abc",成员:[{{_ id:0,主机:"localhost:27001"}},{_id:1,主机:"localhost:27002"}},{_ id:2,主机:"localhost: 27003}]} { "_id":"abc", 成员":[ { "_id":0, 主机":本地主机:27001" }, { "_id":1 主机":本地主机:27002" }, { "_id":2 主机":本地主机:27003" } ] }

Step I: Setting up config cfg ={ _id :"abc", members:[{_id:0, host:"localhost:27001"}, {_id:1, host:"localhost:27002"}, {_id:2, host:"localhost:27003"}] } { "_id" : "abc", "members" : [ { "_id" : 0, "host" : "localhost:27001" }, { "_id" : 1, "host" : "localhost:27002" }, { "_id" : 2, "host" : "localhost:27003" } ] }

步骤II:初始化配置.

STEP II: Initialize the Config.

rs.reconfig(cfg) 2015-10-05T11:34.27.082-0400 E查询错误:无法检索副本集配置:{"ok":0,"errmsg":未运行--replSet","code":76} 在Function.rs.conf(src/mongo/shell/utils.js:1017:11) 在Function.rs.reconfig(src/mongo/shell/utils.js:969:22) 在(shell):1:4在src/mongo/shell/utils.js:1017

rs.reconfig(cfg) 2015-10-05T11:34:27.082-0400 E QUERY Error: Could not retrieve replica set config: { "ok" : 0, "errmsg" : "not running with --replSet", "code" : 76 } at Function.rs.conf (src/mongo/shell/utils.js:1017:11) at Function.rs.reconfig (src/mongo/shell/utils.js:969:22) at (shell):1:4 at src/mongo/shell/utils.js:1017

推荐答案

确保在/etc/mongod.conf

replication:
  replSetName: "somename"

然后重新启动您的mongod.

Then restart your mongod.

sudo service mongod stop
sudo service mongod start
sudo service mongod restart

这篇关于副本集错误代码76的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆