Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the common mongodb operation and maintenance monitoring and implementation plans?

Shulou Source: shulou.com Published: 2022-05-31 14:37:05 11月03日 Update

This article mainly explains "what are the common operation and maintenance monitoring and implementation plans of mongodb". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the common operation and maintenance monitoring and implementation plans of mongodb"?

Query slow requests for more than 3 seconds. Test library needs to be replaced with a specific db name.

Db.currentOp (

{

"active": true

"secs_running": {"$gt": 3}

"ns": / ^ test\. /

}

)

Query all write operations waiting for a lock

Db.currentOp (

{

"waitingForLock": true

$or: [

{"op": {"$in": ["insert", "update", "remove"]}}

{"query.findandmodify": {$exists: true}}

]

}

)

Batch kill slow query

Db.currentOp (

{

"active": true

"microsecs_running": {"$gt": 100}

"ns": / ^ test2\. /

}. Inprog.forEach (

Function (op)

{

Db.killOp (op.opid)

Printjson (op)

}

)

Query requests exceeding 0.1s

Db.currentOp ({secs_running: {$gte: 0.1}})

At this point, I believe you have a deeper understanding of "what are the common operation and maintenance monitoring and implementation plans of mongodb". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Query common monitoring content learning practical deeper interest practicality practical easy to operate method more friends being website channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB macOS MySQL Docker