我制作了一个 mongodb replicaSet,其中包含一个 primary、secondary 和一个 arbiter。
我面临的问题是,当我最初启动 mongodb 服务器时,它是以辅助模式启动的
那是最初当我在终端上键入 mongo 时,它显示为
ubsc:SECONDARY>
我使用创建了一个副本集
config = {with all my server details }
rs.reconfig(config)
我也尝试过使用 rs.add(serverhoststr) 选项。
这是我的 mongo shell 输出和日志文件下面
ubsc:PRIMARY> rs.status()
{
"set" : "ubsc",
"date" : ISODate("2013-10-31T19:09:26Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "mongoA:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 2210,
"optime" : Timestamp(1383246016, 1),
"optimeDate" : ISODate("2013-10-31T19:00:16Z"),
"self" : true
},
{
"_id" : 1,
"name" : "mongoB:27018",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 576,
"optime" : Timestamp(1383246016, 1),
"optimeDate" : ISODate("2013-10-31T19:00:16Z"),
"lastHeartbeat" : ISODate("2013-10-31T19:09:26Z"),
"lastHeartbeatRecv" : ISODate("2013-10-31T19:09:24Z"),
"pingMs" : 0,
"syncingTo" : "192.168.2.67:27017"
},
{
"_id" : 2,
"name" : "mongoC:27019",
"health" : 1,
"state" : 10,
"stateStr" : "ARBITER",
"uptime" : 550,
"lastHeartbeat" : ISODate("2013-10-31T19:09:26Z"),
"lastHeartbeatRecv" : ISODate("2013-10-31T19:09:25Z"),
"pingMs" : 0
}
],
"ok" : 1
}
MongoDB日志
Fri Nov 1 01:22:00.981 [initandlisten] MongoDB starting : pid=13177 port=27017 dbpath=/data/mongodb 64-bit host=MLDev5
Fri Nov 1 01:22:00.982 [initandlisten] db version v2.4.6
Fri Nov 1 01:22:00.982 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Fri Nov 1 01:22:00.982 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Fri Nov 1 01:22:00.982 [initandlisten] allocator: tcmalloc
Fri Nov 1 01:22:00.982 [initandlisten] options: { config: "mongod1.conf", dbpath: "/data/mongodb", fork: "true", logpath: "/data/mongodb/mongodb.log", nojournal: "true", port: 27017, replSet: "ubsc", rest: "true" }
Fri Nov 1 01:22:01.000 [initandlisten] waiting for connections on port 27017
Fri Nov 1 01:22:01.004 [websvr] admin web console waiting for connections on port 28017
Fri Nov 1 01:22:01.008 [rsStart] replSet I am MongoA:27017
Fri Nov 1 01:22:01.009 [rsStart] replSet STARTUP2
rs.conf
ubsc:PRIMARY> rs.conf()
{
"_id" : "ubsc",
"version" : 10,
"members" : [
{
"_id" : 0,
"host" : "mongoA:27017"
},
{
"_id" : 1,
"host" : "mongoB:27018"
},
{
"_id" : 2,
"host" : "mongoC:27019",
"arbiterOnly" : true
}
]
}
请让我知道为什么最初服务器以辅助模式启动?
很抱歉给大家带来麻烦,但找不到任何解决方案