点击上方“IT那活儿”公众号,关注后了解更多内容,不管IT什么活儿,干就完了!!!


背景:
主库dbpath目录使用率96%,剩余空间只有40GB左右,且无法进行磁盘扩容。
PRIMARY:AKTM> db.list***ord.getIndexes();
[
{
"v" : 2,
"key" :{
"timestamp": 1
},
"name" :"timestamp_1",
"background": true,
"ns" :"AKTM.list***ord",
"expireAfterSeconds": NumberLong(2678400)
},
{
"v" : 2,
"key" :{
"_id": 1
},
"name" :"_id_",
"ns" :"AKTM.list***ord"
}
]
db.runCommand( { collMod:"list***ord",
index: { keyPattern: { timestamp:1 },
expireAfterSeconds: 604800
}
})
PRIMARY:AKTM> db.list***ord.getIndexes();
[
{
"v" : 2,
"key" :{
"timestamp": 1
},
"name" :"timestamp_1",
"background": true,
"ns" :"AKTM.list***ord",
"expireAfterSeconds": NumberLong(604800)
},
{
"v" : 2,
"key" :{
"_id": 1
},
"name" :"_id_",
"ns" :"AKTM.list***ord"
}
]
2020-07-01T07:17:49.265+0800 IREPL [replication-147] We are too stale to use10.***.***.83:27017 as a sync source. Blacklisting this sync sourcebecause our last fetched timestamp: Timestamp(1593529482, 5082) isbefore their earliest timestamp: Timestamp(1593553525, 1720) for 1minuntil: 2020-07-01T07:18:49.265+0800
2020-07-01T07:17:49.266+0800 IREPL [replication-147] sync source candidate: 10.**.***.138:27017
2020-07-01T07:17:49.268+0800 IREPL [replication-147] We are too stale to use10.25.151.138:27017 as a sync source. Blacklisting this sync sourcebecause our last fetched timestamp: Timestamp(1593529482, 5082) isbefore their earliest timestamp: Timestamp(1593553515, 601) for 1minuntil: 2020-07-01T07:18:49.268+0800
repl1:SECONDARY>rs.printReplicationInfo();
configured oplog size: 10240MB
log length start to end: 4704secs(1.31hrs)
oplog first event time: Wed Jul01 2020 06:30:31 GMT+0800 (CST)
oplog last event time: Wed Jul01 2020 07:48:55 GMT+0800 (CST)
now: Wed Jul01 2020 07:48:56 GMT+0800 (CST)
正确的操作方式应该是:
因为主库空间不足,所以应该在另外一个从节点进行oplog扩容db.adminCommand({replSetResizeOplog:1, size: 40960}); 操作前将操作节点的同步源指向扩容了oplog的节点rs.syncFrom(“10.2***.**.138:27017”); 执行compact操作,并随时注意观察oplog保留时间,若oplog大小仍然不够,则继续扩容。

本文作者:刘运彬(上海新炬王翦团队)
本文来源:“IT那活儿”公众号

文章转载自IT那活儿,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




