Computer >> Máy Tính >  >> Lập trình >> MongoDB

Làm thế nào để biết công cụ lưu trữ nào được sử dụng trong MongoDB?

Để biết công cụ lưu trữ nào được sử dụng trong MongoDB, bạn có thể sử dụng StorageEngine. Cú pháp như sau -

db.serverStatus().storageEngine;

Để biết tất cả các chi tiết cấu hình của công cụ lưu trữ, bạn có thể sử dụng cú pháp sau:

db.serverStatus().yourStorageEngineName;

Hãy để chúng tôi thực hiện cú pháp trên để biết công cụ lưu trữ nào đang được sử dụng trong MongoDB. Truy vấn như sau -

> db.serverStatus().storageEngine;

Sau đây là kết quả -

{
   "name" : "wiredTiger",
   "supportsCommittedReads" : true,
   "supportsSnapshotReadConcern" : true,
   "readOnly" : false,
   "persistent" : true
}

Để biết tất cả chi tiết cấu hình về công cụ lưu trữ trên, truy vấn như sau -

> db.serverStatus().wiredTiger;

Sau đây là đầu ra hiển thị chi tiết cấu hình -

{
   "uri" : "statistics:",
   "LSM" : {
      "application work units currently queued" : 0,
      "merge work units currently queued" : 0,
      "rows merged in an LSM tree" : 0,
      "sleep for LSM checkpoint throttle" : 0,
      "sleep for LSM merge throttle" : 0,
      "switch work units currently queued" : 0,
      "tree maintenance operations discarded" : 0,
      "tree maintenance operations executed" : 0,
      "tree maintenance operations scheduled" : 0,
      "tree queue hit maximum" : 0
   },
   "async" : {
      "current work queue length" : 0,
      "maximum work queue length" : 0,
      "number of allocation state races" : 0,
      "number of flush calls" : 0,
      "number of operation slots viewed for allocation" : 0,
      "number of times operation allocation failed" : 0,
      "number of times worker found no work" : 0,
      "total allocations" : 0,
      "total compact calls" : 0,
      "total insert calls" : 0,
      "total remove calls" : 0,
      "total search calls" : 0,
      "total update calls" : 0
   },
   "block-manager" : {
      "blocks pre-loaded" : 173,
      "blocks read" : 482,
      "blocks written" : 312,
      "bytes read" : 2400256,
      "bytes written" : 2953216,
      "bytes written for checkpoint" : 2953216,
      "mapped blocks read" : 0,
      "mapped bytes read" : 0
   },
   "cache" : {
      "application threads page read from disk to cache count" : 157,
      "application threads page read from disk to cache time (usecs)" : 58747,
      "application threads page write from cache to disk count" : 172,
      "application threads page write from cache to disk time (usecs)" : 37010,
      "bytes belonging to page images in the cache" : 663718,
      "bytes belonging to the cache overflow table in the cache" : 182,
      "bytes currently in the cache" : 814060,
      "bytes dirty in the cache cumulative" : 2673442,
      "bytes not belonging to page images in the cache" : 150342,
      "bytes read into cache" : 614554,
      "bytes written from cache" : 1910375,
      "cache overflow cursor application thread wait time (usecs)" : 0,
      "cache overflow cursor internal thread wait time (usecs)" : 0,
      "cache overflow score" : 0,
      "cache overflow table entries" : 0,
      "cache overflow table insert calls" : 0,
      "cache overflow table remove calls" : 0,
      "checkpoint blocked page eviction" : 0,
      "eviction calls to get a page" : 546,
      "eviction calls to get a page found queue empty" : 547,
      "eviction calls to get a page found queue empty after locking" : 0,
      "eviction currently operating in aggressive mode" : 0,
      "eviction empty score" : 0,
      "eviction passes of a file" : 0,
      "eviction server candidate queue empty when topping up" : 0,
      "eviction server candidate queue not empty when topping up" : 0,
      "eviction server evicting pages" : 0,
      "eviction server slept, because we did not make progress with eviction" : 367,
      "eviction server unable to reach eviction goal" : 0,
      "eviction state" : 32,
      "eviction walk target pages histogram - 0-9" : 0,
      "eviction walk target pages histogram - 10-31" : 0,
      "eviction walk target pages histogram - 128 and higher" : 0,
      "eviction walk target pages histogram - 32-63" : 0,
      "eviction walk target pages histogram - 64-128" : 0,
      "eviction walks abandoned" : 0,
      "eviction walks gave up because they restarted their walk twice" : 0,
      "eviction walks gave up because they saw too many pages and found no candidates" : 0,
      "eviction walks gave up because they saw too many pages and found too few candidates" : 0,
      "eviction walks reached end of tree" : 0,
      "eviction walks started from root of tree" : 0,
      "eviction walks started from saved location in tree" : 0,
      "eviction worker thread active" : 4,
      "eviction worker thread created" : 0,
      "eviction worker thread evicting pages" : 2,
      "eviction worker thread removed" : 0,
      "eviction worker thread stable number" : 0,
      "failed eviction of pages that exceeded the in-memory maximum count" : 0,
      "failed eviction of pages that exceeded the in-memory maximum time (usecs)" : 0,
      "files with active eviction walks" : 0,
      "files with new eviction walks started" : 0,
      "force re-tuning of eviction workers once in a while" : 0,
      "hazard pointer blocked page eviction" : 0,
      "hazard pointer check calls" : 2,
      "hazard pointer check entries walked" : 0,
      "hazard pointer maximum array length" : 0,
      "in-memory page passed criteria to be split" : 0,
      "in-memory page splits" : 0,
      "internal pages evicted" : 0,
      "internal pages split during eviction" : 0,
      "leaf pages split during eviction" : 0,
      "maximum bytes configured" : 4803526656,
      "maximum page size at eviction" : 0,
      "modified pages evicted" : 2,
      "modified pages evicted by application threads" : 0,
      "operations timed out waiting for space in cache" : 0,
      "overflow pages read into cache" : 0,
      "page split during eviction deepened the tree" : 0,
      "page written requiring cache overflow records" : 0,
      "pages currently held in the cache" : 349,
      "pages evicted because they exceeded the in-memory maximum count" : 0,
      "pages evicted because they exceeded the in-memory maximum time (usecs)" : 0,
      "pages evicted because they had chains of deleted items count" : 0,
      "pages evicted because they had chains of deleted items time (usecs)" : 0,
      "pages evicted by application threads" : 0,
      "pages queued for eviction" : 0,
      "pages queued for urgent eviction" : 2,
      "pages queued for urgent eviction during walk" : 0,
      "pages read into cache" : 324,
      "pages read into cache after truncate" : 11,
      "pages read into cache after truncate in prepare state" : 0,
      "pages read into cache requiring cache overflow entries" : 0,
      "pages read into cache requiring cache overflow for checkpoint" : 0,
      "pages read into cache skipping older cache overflow entries" : 0,
      "pages read into cache with skipped cache overflow entries needed later" : 0,
      "pages read into cache with skipped cache overflow entries needed later by checkpoint" : 0,
      "pages requested from the cache" : 46897,
      "pages seen by eviction walk" : 0,
      "pages selected for eviction unable to be evicted" : 0,
      "pages walked for eviction" : 0,
      "pages written from cache" : 175,
      "pages written requiring in-memory restoration" : 0,
      "percentage overhead" : 8,
      "tracked bytes belonging to internal pages in the cache" : 40080,
      "tracked bytes belonging to leaf pages in the cache" : 773980,
      "tracked dirty bytes in the cache" : 0,
      "tracked dirty pages in the cache" : 0,
      "unmodified pages evicted" : 0
   },
   "connection" : {
      "auto adjusting condition resets" : 561,
      "auto adjusting condition wait calls" : 42647,
      "detected system time went backwards" : 0,
      "files currently open" : 170,
      "memory allocations" : 277416,
      "memory frees" : 266135,
      "memory re-allocations" : 23688,
      "pthread mutex condition wait calls" : 116127,
      "pthread mutex shared lock read-lock calls" : 140031,
      "pthread mutex shared lock write-lock calls" : 10159,
      "total fsync I/Os" : 760,
      "total read I/Os" : 2257,
      "total write I/Os" : 875
   },
   "cursor" : {
      "cursor close calls that result in cache" : 482,
      "cursor create calls" : 536,
      "cursor insert calls" : 296,
      "cursor modify calls" : 0,
      "cursor next calls" : 2968,
      "cursor operation restarted" : 0,
      "cursor prev calls" : 212,
      "cursor remove calls" : 9,
      "cursor reserve calls" : 0,
      "cursor reset calls" : 46322,
      "cursor search calls" : 27066,
      "cursor search near calls" : 441,
      "cursor sweep buckets" : 41532,
      "cursor sweep cursors closed" : 0,
      "cursor sweep cursors examined" : 13338,
      "cursor sweeps" : 6922,
      "cursor update calls" : 0,
      "cursors currently cached" : 170,
      "cursors reused from cache" : 312,
      "truncate calls" : 0
   },
   "data-handle" : {
      "connection data handles currently active" : 489,
      "connection sweep candidate became referenced" : 0,
      "connection sweep dhandles closed" : 0,
      "connection sweep dhandles removed from hash list" : 207,
      "connection sweep time-of-death sets" : 972,
      "connection sweeps" : 3469,
      "session dhandles swept" : 0,
      "session sweep attempts" : 373
   },
   "lock" : {
      "checkpoint lock acquisitions" : 437,
      "checkpoint lock application thread wait time (usecs)" : 0,
      "checkpoint lock internal thread wait time (usecs)" : 0,
      "commit timestamp queue lock application thread time waiting (usecs)" : 0,
      "commit timestamp queue lock internal thread time waiting (usecs)" : 0,
      "commit timestamp queue read lock acquisitions" : 0,
      "commit timestamp queue write lock acquisitions" : 0,
      "dhandle lock application thread time waiting (usecs)" : 0,
      "dhandle lock internal thread time waiting (usecs)" : 0,
      "dhandle read lock acquisitions" : 28619,
      "dhandle write lock acquisitions" : 909,
      "metadata lock acquisitions" : 116,
      "metadata lock application thread wait time (usecs)" : 0,
      "metadata lock internal thread wait time (usecs)" : 0,
      "read timestamp queue lock application thread time waiting (usecs)" : 0,
      "read timestamp queue lock internal thread time waiting (usecs)" : 0,
      "read timestamp queue read lock acquisitions" : 0,
      "read timestamp queue write lock acquisitions" : 0,
      "schema lock acquisitions" : 613,
      "schema lock application thread wait time (usecs)" : 0,
      "schema lock internal thread wait time (usecs)" : 0,
      "table lock application thread time waiting for the table lock (usecs)" : 0,
      "table lock internal thread time waiting for the table lock (usecs)" : 0,
      "table read lock acquisitions" : 0,
      "table write lock acquisitions" : 645,
      "txn global lock application thread time waiting (usecs)" : 0,
      "txn global lock internal thread time waiting (usecs)" : 0,
      "txn global read lock acquisitions" : 375,
      "txn global write lock acquisitions" : 354
   },
   "log" : {
      "busy returns attempting to switch slots" : 1,
      "force archive time sleeping (usecs)" : 0,
      "log bytes of payload data" : 49104,
      "log bytes written" : 105216,
      "log files manually zero-filled" : 0,
      "log flush operations" : 68872,
      "log force write operations" : 75951,
      "log force write operations skipped" : 75776,
      "log records compressed" : 36,
      "log records not compressed" : 23,
      "log records too small to compress" : 493,
      "log release advances write LSN" : 353,
      "log scan operations" : 4,
      "log scan records requiring two reads" : 3,
      "log server thread advances write LSN" : 175,
      "log server thread write LSN walk skipped" : 8776,
      "log sync operations" : 528,
      "log sync time duration (usecs)" : 29656979,
      "log sync_dir operations" : 1,
      "log sync_dir time duration (usecs)" : 0,
      "log write operations" : 552,
      "logging bytes consolidated" : 104704,
      "maximum log file size" : 104857600,
      "number of pre-allocated log files to create" : 2,
      "pre-allocated log files not ready and missed" : 1,
      "pre-allocated log files prepared" : 2,
      "pre-allocated log files used" : 0,
      "records processed by log scan" : 636,
      "slot close lost race" : 0,
      "slot close unbuffered waits" : 0,
      "slot closures" : 528,
      "slot join atomic update races" : 0,
      "slot join calls atomic updates raced" : 0,
      "slot join calls did not yield" : 552,
      "slot join calls found active slot closed" : 0,
      "slot join calls slept" : 0,
      "slot join calls yielded" : 0,
      "slot join found active slot closed" : 0,
      "slot joins yield time (usecs)" : 0,
      "slot transitions unable to find free slot" : 0,
      "slot unbuffered writes" : 0,
      "total in-memory size of compressed records" : 79123,
      "total log buffer size" : 33554432,
      "total size of compressed records" : 33250,
      "written slots coalesced" : 0,
      "yields waiting for previous log file close" : 0
   },
   "perf" : {
      "file system read latency histogram (bucket 1) - 10-49ms" : 5,
      "file system read latency histogram (bucket 2) - 50-99ms" : 0,
      "file system read latency histogram (bucket 3) - 100-249ms" : 0,
      "file system read latency histogram (bucket 4) - 250-499ms" : 0,
      "file system read latency histogram (bucket 5) - 500-999ms" : 0,
      "file system read latency histogram (bucket 6) - 1000ms+" : 0,
      "file system write latency histogram (bucket 1) - 10-49ms" : 9,
      "file system write latency histogram (bucket 2) - 50-99ms" : 0,
      "file system write latency histogram (bucket 3) - 100-249ms" : 0,
      "file system write latency histogram (bucket 4) - 250-499ms" : 0,
      "file system write latency histogram (bucket 5) - 500-999ms" : 0,
      "file system write latency histogram (bucket 6) - 1000ms+" : 0,
      "operation read latency histogram (bucket 1) - 100-249us" : 0,
      "operation read latency histogram (bucket 2) - 250-499us" : 0,
      "operation read latency histogram (bucket 3) - 500-999us" : 44,
      "operation read latency histogram (bucket 4) - 1000-9999us" : 20,
      "operation read latency histogram (bucket 5) - 10000us+" : 2,
      "operation write latency histogram (bucket 1) - 100-249us" : 0,
      "operation write latency histogram (bucket 2) - 250-499us" : 0,
      "operation write latency histogram (bucket 3) - 500-999us" : 7,
      "operation write latency histogram (bucket 4) - 1000-9999us" : 1,
      "operation write latency histogram (bucket 5) - 10000us+" : 1
   },
   "reconciliation" : {
      "fast-path pages deleted" : 0,
      "page reconciliation calls" : 193,
      "page reconciliation calls for eviction" : 1,
      "pages deleted" : 18,
      "split bytes currently awaiting free" : 0,
      "split objects currently awaiting free" : 0
   },
   "session" : {
      "open cursor count" : 22,
      "open session count" : 19,
      "session query timestamp calls" : 0,
      "table alter failed calls" : 0,
      "table alter successful calls" : 321,
      "table alter unchanged and skipped" : 963,
      "table compact failed calls" : 0,
      "table compact successful calls" : 0,
      "table create failed calls" : 0,
      "table create successful calls" : 7,
      "table drop failed calls" : 0,
      "table drop successful calls" : 0,
      "table rebalance failed calls" : 0,
      "table rebalance successful calls" : 0,
      "table rename failed calls" : 0,
      "table rename successful calls" : 0,
      "table salvage failed calls" : 0,
      "table salvage successful calls" : 0,
      "table truncate failed calls" : 0,
      "table truncate successful calls" : 0,
      "table verify failed calls" : 0,
      "table verify successful calls" : 0
   },
   "thread-state" : {
      "active filesystem fsync calls" : 0,
      "active filesystem read calls" : 0,
      "active filesystem write calls" : 0
   },
   "thread-yield" : {
      "application thread time evicting (usecs)" : 0,
      "application thread time waiting for cache (usecs)" : 0,
      "connection close blocked waiting for transaction state stabilization" : 0,
      "connection close yielded for lsm manager shutdown" : 0,
      "data handle lock yielded" : 0,
      "get reference for page index and slot time sleeping (usecs)" : 0,
      "log server sync yielded for log write" : 0,
      "page access yielded due to prepare state change" : 0,
      "page acquire busy blocked" : 0,
      "page acquire eviction blocked" : 0,
      "page acquire locked blocked" : 0,
      "page acquire read blocked" : 0,
      "page acquire time sleeping (usecs)" : 0,
      "page delete rollback time sleeping for state change (usecs)" : 0,
      "page reconciliation yielded due to child modification" : 0
   },
   "transaction" : {
      "Number of prepared updates" : 0,
      "Number of prepared updates added to cache overflow" : 0,
      "Number of prepared updates resolved" : 0,
      "commit timestamp queue entries walked" : 0,
      "commit timestamp queue insert to empty" : 0,
      "commit timestamp queue inserts to head" : 0,
      "commit timestamp queue inserts total" : 0,
      "commit timestamp queue length" : 0,
      "number of named snapshots created" : 0,
      "number of named snapshots dropped" : 0,
      "prepared transactions" : 0,
      "prepared transactions committed" : 0,
      "prepared transactions currently active" : 0,
      "prepared transactions rolled back" : 0,
      "query timestamp calls" : 1,
      "read timestamp queue entries walked" : 0,
      "read timestamp queue insert to empty" : 0,
      "read timestamp queue inserts to head" : 0,
      "read timestamp queue inserts total" : 0,
      "read timestamp queue length" : 0,
      "rollback to stable calls" : 0,
      "rollback to stable updates aborted" : 0,
      "rollback to stable updates removed from cache overflow" : 0,
      "set timestamp calls" : 0,
      "set timestamp commit calls" : 0,
      "set timestamp commit updates" : 0,
      "set timestamp oldest calls" : 0,
      "set timestamp oldest updates" : 0,
      "set timestamp stable calls" : 0,
      "set timestamp stable updates" : 0,
      "transaction begins" : 309,
      "transaction checkpoint currently running" : 0,
      "transaction checkpoint generation" : 117,
      "transaction checkpoint max time (msecs)" : 2264,
      "transaction checkpoint min time (msecs)" : 4,
      "transaction checkpoint most recent time (msecs)" : 43,
      "transaction checkpoint scrub dirty target" : 0,
      "transaction checkpoint scrub time (msecs)" : 0,
      "transaction checkpoint total time (msecs)" : 15771,
      "transaction checkpoints" : 116,
      "transaction checkpoints skipped because database was clean" : 0,
      "transaction failures due to cache overflow" : 0,
      "transaction fsync calls for checkpoint after allocating the transaction ID" : 116,
      "transaction fsync duration for checkpoint after allocating the transaction ID (usecs)" : 0,
      "transaction range of IDs currently pinned" : 0,
      "transaction range of IDs currently pinned by a checkpoint" : 0,
      "transaction range of IDs currently pinned by named snapshots" : 0,
      "transaction range of timestamps currently pinned" : 0,
      "transaction range of timestamps pinned by a checkpoint" : 0,
      "transaction range of timestamps pinned by the oldest timestamp" : 0,
      "transaction sync calls" : 0,
      "transactions committed" : 40,
      "transactions rolled back" : 269,
      "update conflicts" : 0
   },
   "concurrentTransactions" : {
      "write" : {
         "out" : 0,
         "available" : 128,
         "totalTickets" : 128
      },
      "read" : {
         "out" : 1,
         "available" : 127,
         "totalTickets" : 128
      }
   }
}