replica-set - mongodb replica set 添加从节点出错?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-02 09:19:18
0
0
1734

我在三台虚拟机上配置mongodb replica set副本集,使用conf文件启动mongodb

启动命令:
/appdev/mongodb/bin/mongod --config /data/mongodb0/conf/mongodb0.conf -quiet
conf文件内容:
port=29001
bind_ip=192.168.1.205
dbpath=/data/mongodb0
replSet=rs0
logpath=/data/mongodb0/mongodb0.log
logappend=true
journal=true

另外两台机器的启动命令和conf配置文件内容都是一样的,只有文件名和ip不同

将205server设置为primary节点

rs0:PRIMARY> rs.status()
{
        "set" : "rs0",
        "date" : ISODate("2016-06-02T08:03:50.304Z"),
        "myState" : 1,
        "term" : NumberLong(1),
        "heartbeatIntervalMillis" : NumberLong(2000),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "192.168.1.205:29001",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 6111,
                        "optime" : {
                                "ts" : Timestamp(1464849936, 1),
                                "t" : NumberLong(1)
                        },
                        "optimeDate" : ISODate("2016-06-02T06:45:36Z"),
                        "electionTime" : Timestamp(1464849935, 2),
                        "electionDate" : ISODate("2016-06-02T06:45:35Z"),
                        "configVersion" : 1,
                        "self" : true
                }
        ],
        "ok" : 1
}
rs0:PRIMARY> 
rs0:PRIMARY> rs.conf()
{
        "_id" : "rs0",
        "version" : 1,
        "protocolVersion" : NumberLong(1),
        "members" : [
                {
                        "_id" : 0,
                        "host" : "192.168.1.205:29001",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                }
        ],
        "settings" : {
                "chainingAllowed" : true,
                "heartbeatIntervalMillis" : 2000,
                "heartbeatTimeoutSecs" : 10,
                "electionTimeoutMillis" : 10000,
                "getLastErrorModes" : {

                },
                "getLastErrorDefaults" : {
                        "w" : 1,
                        "wtimeout" : 0
                },
                "replicaSetId" : ObjectId("574fd60f2e5b59fe492a9c28")
        }
}
rs0:PRIMARY> 

然后开始添加从节点:

rs0:PRIMARY> rs.add("192.168.1.206:29001")
{
        "ok" : 0,
        "errmsg" : "Our set name did not match that of 192.168.1.206:29001",
        "code" : 103
}
rs0:PRIMARY> 

然后就是报错信息了:"errmsg" : "Our set name did not match that of 192.168.1.206:29001"
求助各位有经验的行家!

曾经蜡笔没有小新
曾经蜡笔没有小新

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板