Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[MongoDB] manage command collection

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[TOC]

Slow query / / Open slow query record db.setProfilingLevel for more than 2000 milliseconds (1j2000) / / View the last five slow query show profile// query db.system.profile.find (). Sort ({'millis':-1}). Pretty// View query Plan db.Sync_Log.find ({"$and": [{"mbid": {$eq 7542163}}) {'tasking: {$gte:2333}). Explain () / close slow query record db.setProfilingLevel (0) Task Management stops queries db.currentOp () .inprog.forEach (function (item) {if (item.secs_running > 1000) db.killOp (item.opid)) }) stop querying a table db.currentOp () .inprog.forEach (function (item) {if (item.ns = = "dbA.tbA") db.killOp (item.opid)}) find some type of task db.currentOp () .inprog.forEach (function (item) {if (item.op== "query") {print (item.opid,item.op)) }}) another way of thinking is to view db.currentOp ({$and: [{ns: {$ne:'local.oplog.rs'}}, {ns: {$ne:'local.replset.minvalid'}}, {ns: {$ne:'admin.$cmd'}}) {ns: {$ne:''}) replica set management modify hostname cfg = rs.conf () cfg.members [0] .host = "xxxhost: 20000" cfg.members [1] .host = "yyyhost: 20001" cfg.members [2] .host = "zzzhost: 20002" rs.reconfig (cfg) shard management modify primary shard

When a MongoDB sharding cluster creates a database, the system selects a node with the largest amount of available space as its default node.

Db.runCommand ({"movePrimary": "test", "to": "shard0000"}) manually migrate the data blocks of the collection

Purpose: pre-migrate data when a node needs to be offline

Sh.moveChunk ("dbA.collectionB", {collC: "53187"}, "shard0019")

If there is an error

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report