[英]How to check index creation progress in MongoDB via shell
在 MongoDB 中的數十億條記錄的大型集合中,提交了索引創建。 我運行db.getCollection('mycollection').aggregate([ { "$indexStats": { } } ] )
並得到包含屬性building:true
的結果。
問題:如何檢查索引構建的進度,例如完成百分比?
db.currentOp
https://www.mongodb.com/docs/manual/reference/command/currentOp/
它返回很多,但您對command
具有createIndexes
或msg
字符串包含“Index Build”的文檔感興趣。
如果 output 太吵,可以直接過濾運行 adminCommand:
db.adminCommand(
{
currentOp: true,
$or: [
{ op: "command", "command.createIndexes": { $exists: true } },
{ op: "none", "msg" : /^Index Build/ }
]
}
)
文檔的現場progress
顯示done
和total
。 你可以算一下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.