Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

background - mongodb status of index creation job

I'm using MongoDB and have a collection with roughly 75 million records. I have added a compound index on two "fields" by using the following command:

db.my_collection.ensureIndex({"data.items.text":1, "created_at":1},{background:true}).

Two days later I'm trying to see the status of the index creation. Running db.currentOp() returns {}, however when I try to create another index I get this error message:

cannot add index with a background operation in progress.

Is there a way to check the status/progress of the index creation job?

One thing to add - I am using mongodb version 2.0.6. Thanks!

question from:https://stackoverflow.com/questions/22309268/mongodb-status-of-index-creation-job

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

At the mongo shell, type below command to show the current progress:

rs0:PRIMARY> db.currentOp(true).inprog.forEach(function(op){ if(op.msg!==undefined) print(op.msg) })

Index Build (background) Index Build (background): 1431577/55212209 2%

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...