这是我尝试过的,但似乎不起作用,只杀死1个手术。
function s() {
t = db.currentOp()['inprog'];
k= new Array();
for(i=0;i< t.length;i++)
{
if(t[i]["ns"].indexOf("my_namespace") != -1) //fetch all required current Operations
k.push(t[i]);
}
for(j=0;j<k.length;k++)
{
db.killOp(k[j]['opid']); // kill them by opid , works only once
}
最佳答案:
既然您使用的是v1.6,那么下面的jira可能与您的问题有关,并在1.7.2中得到了解决:https://jira.mongodb.org/browse/SERVER-1816
因此,如果这是问题所在,请尝试升级到1.8。或者您可以尝试以下操作:
for(each operation op identified in first loop)
{
if(op still exists) { // op could have finished
kill op;
while(op still there) // May not be possible to kill op
{ // if another is being killed
wait 1 sec;
}
}
}