我最近在mongodb副本集中添加了一个新成员。它执行了一次初始同步,然后在被选为PRIMARY后不久。
但是当我检查新节点上的数据库大小时,我感到担心,因为并非所有数据库似乎都已在“初始同步”上复制。
新节点(新PRIMARY)上的数据库大小:
mongo_data:PRIMARY> show databases
DataSets 457.73046875GB
History 0.203125GB
PublicRecords 0.203125GB
Starfields 47.9306640625GB
admin (empty)
config (empty)
data_sets 0.203125GB
local 96.03125GB
mongo_data_local (empty)
mongo_data_test (empty)
nagios 0.203125GB
test (empty)
原始节点(旧PRIMARY)上的数据库大小:\
mongo_data:SECONDARY> show databases
DataSets 453.732GB
History 0.203GB
PublicRecords 0.203GB
Starfields 75.917GB
admin 0.078GB
config 0.078GB
data_sets 0.078GB
local 435.865GB
mongo_data_local 0.078GB
mongo_data_test 0.078GB
nagios 0.203GB
test 0.0
我应该担心吗?可能是什么原因造成的?其他数据库大小也不匹配。我知道本地数据库对复制是隐藏的,因此我对此并不担心。
rs.status()的输出:
mongo_data:PRIMARY> rs.status()
{
"set" : "mongo_data",
"date" : ISODate("2019-02-18T17:01:32Z"),
"myState" : 1,
"members" : [
{
"_id" : 2,
"name" : "[ip addr]",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 223858,
"optime" : {
"t" : 1550508312,
"i" : 6
},
"optimeDate" : ISODate("2019-02-18T16:45:12Z"),
"lastHeartbeat" : ISODate("2019-02-18T17:01:30Z"),
"lastHeartbeatRecv" : ISODate("2019-02-18T17:01:31Z"),
"pingMs" : 0
},
{
"_id" : 3,
"name" : "[ip addr]",
"health" : 1,
"state" : 7,
"stateStr" : "ARBITER",
"uptime" : 223858,
"lastHeartbeat" : ISODate("2019-02-18T17:01:31Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : 0
},
{
"_id" : 4,
"name" : "[ip addr]",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 224550,
"optime" : {
"t" : 1550508312,
"i" : 6
},
"optimeDate" : ISODate("2019-02-18T16:45:12Z"),
"self" : true
}
],
"ok" : 1
}
mongo_data:PRIMARY>