查看当前操作
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错过一些重要的写入错误。
幽灵写入
组织幽灵写入的最好方法就是采用确认写入的方式:直到上一个写入已经完成再进行下一次的写入,而不是上一次写入的数据停留在数据服务器的缓冲区时就开始下一次写入。
本文介绍如何使用MongoDB的db.currentOp()和db.killOp()命令来管理当前的操作,包括查看和终止特定的操作。同时讨论了如何避免幽灵写入的问题,并强调了确认写入的重要性。
803

被折叠的 条评论
为什么被折叠?



