查看当前操作
db.currentOp()
过滤查看
db.currentOp({"ns" : "prod.users"})
杀死操作,不是所有的操作都可以被杀死,**operations can only be killed when they
yield, so updates, finds, and removes can all be killed**
db.killOp(123)
**replication thread (which will continue fetch‐
ing more operations from the sync source for as long as possible) and the writeback listener for sharding.**
上面这两种操作被杀死后MongoDB会重新启动它们,但是杀死replication thread会停止复制操作,杀死writeback listener会使mongos
错过一些重要的写入错误。
幽灵写入
组织幽灵写入的最好方法就是采用确认写入的方式:直到上一个写入已经完成再进行下一次的写入,而不是上一次写入的数据停留在数据服务器的缓冲区时就开始下一次写入。