How to know current storage engine in MongoDB ?

 

Ideally, db.serverStatus() gives the all the server related information including storage engine details, however below command will specifically tell you the storage engine details.

Connect to the respective Replica set member and execute below command.

rs1:PRIMARY> db.serverStatus().storageEngine.name

wiredTiger

OR
rs1:PRIMARY> db.serverStatus().storageEngine
{ “name” : “wiredTiger”, “supportsCommittedReads” : true }

Once you know the current engine from the above command, to see it’s stats you can type.

To know all the stats of WiredTiger

rs1:PRIMARY> db.serverStatus().wiredTiger
{
“uri” : “statistics:”,
“LSM” : {
“sleep for LSM checkpoint throttle” : 0,
“sleep for LSM merge throttle” : 0,
“rows merged in an LSM tree” : 0,
“application work units currently queued” : 0,
“merge work units currently queued” : 0,
“tree queue hit maximum” : 0,
“switch work units currently queued” : 0,
“tree maintenance operations scheduled” : 0,
“tree maintenance operations discarded” : 0,
“tree maintenance operations executed” : 0
},
“async” : {
“number of allocation state races” : 0,
“number of operation slots viewed for allocation” : 0,
“current work queue length” : 0,
“number of flush calls” : 0,
“number of times operation allocation failed” : 0,
“maximum work queue length” : 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” : {
“mapped bytes read” : 0,
“bytes read” : 364544,
“bytes written” : 36605952,
“mapped blocks read” : 0,
“blocks pre-loaded” : 0,
“blocks read” : 88,
“blocks written” : 4326
},
“cache” : {
“tracked dirty bytes in the cache” : 0,
“tracked bytes belonging to internal pages in the cache” : 20650,
“bytes currently in the cache” : 191949137,
“tracked bytes belonging to leaf pages in the cache” : 191928487,
“maximum bytes configured” : 1073741824,
“tracked bytes belonging to overflow pages in the cache” : 0,
“bytes read into cache” : 32746,
“bytes written from cache” : 115329925,
“pages evicted by application threads” : 0,
“checkpoint blocked page eviction” : 0,
“unmodified pages evicted” : 0,
“page split during eviction deepened the tree” : 0,
“modified pages evicted” : 4,
“pages selected for eviction unable to be evicted” : 0,
“pages evicted because they exceeded the in-memory maximum” : 0,
“pages evicted because they had chains of deleted items” : 26,
“failed eviction of pages that exceeded the in-memory maximum” : 0,
“hazard pointer blocked page eviction” : 0,
“internal pages evicted” : 0,
“maximum page size at eviction” : 8388628,
“eviction server candidate queue empty when topping up” : 26,
“eviction server candidate queue not empty when topping up” : 0,
“eviction server evicting pages” : 0,
“eviction server populating queue, but not evicting pages” : 25,
“eviction server unable to reach eviction goal” : 0,
“internal pages split during eviction” : 0,
“leaf pages split during eviction” : 2,
“pages walked for eviction” : 15341,
“eviction worker thread evicting pages” : 2,
“in-memory page splits” : 26,
“in-memory page passed criteria to be split” : 52,
“lookaside table insert calls” : 0,
“lookaside table remove calls” : 0,
“percentage overhead” : 8,
“tracked dirty pages in the cache” : 0,
“pages currently held in the cache” : 58,
“pages read into cache” : 1,
“pages read into cache requiring lookaside entries” : 0,
“pages written from cache” : 4137,
“page written requiring lookaside records” : 0,
“pages written requiring in-memory restoration” : 0
},
“connection” : {
“pthread mutex condition wait calls” : 1589229,
“files currently open” : 17,
“memory allocations” : 3084899,
“memory frees” : 567099,
“memory re-allocations” : 38035,
“total read I/Os” : 106,
“pthread mutex shared lock read-lock calls” : 26184,
“pthread mutex shared lock write-lock calls” : 153,
“total write I/Os” : 4379
},
“cursor” : {
“cursor create calls” : 14099,
“cursor insert calls” : 1364743,
“cursor next calls” : 1090817,
“cursor prev calls” : 17,
“cursor remove calls” : 36,
“cursor reset calls” : 1509370,
“cursor restarted searches” : 0,
“cursor search calls” : 153577,
“cursor search near calls” : 5039,
“truncate calls” : 0,
“cursor update calls” : 0
},
“data-handle” : {
“connection data handles currently active” : 16,
“session dhandles swept” : 1,
“session sweep attempts” : 61,
“connection sweep dhandles closed” : 0,
“connection sweep candidate became referenced” : 0,
“connection sweep dhandles removed from hash list” : 59,
“connection sweep time-of-death sets” : 74,
“connection sweeps” : 856
},
“log” : {
“total log buffer size” : 0,
“log bytes of payload data” : 0,
“log bytes written” : 0,
“yields waiting for previous log file close” : 0,
“total size of compressed records” : 0,
“total in-memory size of compressed records” : 0,
“log records too small to compress” : 0,
“log records not compressed” : 0,
“log records compressed” : 0,
“log flush operations” : 0,
“maximum log file size” : 0,
“pre-allocated log files prepared” : 0,
“number of pre-allocated log files to create” : 0,
“pre-allocated log files not ready and missed” : 0,
“pre-allocated log files used” : 0,
“log release advances write LSN” : 0,
“records processed by log scan” : 0,
“log scan records requiring two reads” : 0,
“log scan operations” : 0,
“consolidated slot closures” : 0,
“written slots coalesced” : 0,
“logging bytes consolidated” : 0,
“consolidated slot joins” : 0,
“consolidated slot join races” : 0,
“busy returns attempting to switch slots” : 0,
“consolidated slot join transitions” : 0,
“consolidated slot unbuffered writes” : 0,
“log sync operations” : 0,
“log sync_dir operations” : 0,
“log server thread advances write LSN” : 0,
“log write operations” : 0,
“log files manually zero-filled” : 0
},
“reconciliation” : {
“pages deleted” : 2,
“fast-path pages deleted” : 0,
“page reconciliation calls” : 248,
“page reconciliation calls for eviction” : 3,
“split bytes currently awaiting free” : 0,
“split objects currently awaiting free” : 0
},
“session” : {
“open cursor count” : 36,
“open session count” : 16
},
“thread-yield” : {
“page acquire busy blocked” : 0,
“page acquire eviction blocked” : 0,
“page acquire locked blocked” : 1,
“page acquire read blocked” : 0,
“page acquire time sleeping (usecs)” : 1000
},
“transaction” : {
“transaction begins” : 465119,
“transaction checkpoints” : 143,
“transaction checkpoint generation” : 143,
“transaction checkpoint currently running” : 0,
“transaction checkpoint max time (msecs)” : 2903,
“transaction checkpoint min time (msecs)” : 4,
“transaction checkpoint most recent time (msecs)” : 118,
“transaction checkpoint total time (msecs)” : 21281,
“transactions committed” : 341181,
“transaction failures due to cache overflow” : 0,
“transaction range of IDs currently pinned by a checkpoint” : 0,
“transaction range of IDs currently pinned” : 0,
“transaction range of IDs currently pinned by named snapshots” : 0,
“transactions rolled back” : 123938,
“number of named snapshots created” : 0,
“number of named snapshots dropped” : 0,
“transaction sync calls” : 0
},
“concurrentTransactions” : {
“write” : {
“out” : 0,
“available” : 128,
“totalTickets” : 128
},
“read” : {
“out” : 0,
“available” : 128,
“totalTickets” : 128
}
}
}
rs1:PRIMARY>

 

Below are the sample file structure of MongoDB WiredTiger

 

#ll -lhtr /home/srinivas/mongodb-3.2/data/shard1_1/
total 32M
drwxr-xr-x 16 root root 4.0K Jan 4 11:55 ../
-rw-r–r– 1 root root 21 Jan 4 11:55 WiredTiger.lock
-rw-r–r– 1 root root 49 Jan 4 11:55 WiredTiger
-rw-r–r– 1 root root 4.0K Jan 4 11:55 WiredTigerLAS.wt
-rw-r–r– 1 root root 5 Jan 4 11:55 mongod.lock
-rw-r–r– 1 root root 95 Jan 4 11:55 storage.bson
-rw-r–r– 1 root root 16K Jan 4 11:56 index-3–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 index-1–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 collection-2–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 collection-0–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 index-8–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 index-6–1195417548931681886.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 collection-7–1195417548931681886.wt
-rw-r–r– 1 root root 32K Jan 4 12:04 collection-5–1195417548931681886.wt
-rw-r–r– 1 root root 36K Jan 4 12:43 _mdb_catalog.wt
-rw-r–r– 1 root root 3.8M Jan 4 13:10 index-11–1195417548931681886.wt
-rw-r–r– 1 root root 2.8M Jan 4 13:10 index-10–1195417548931681886.wt
-rw-r–r– 1 root root 8.8M Jan 4 13:10 collection-9–1195417548931681886.wt
-rw-r–r– 1 root root 16M Jan 4 13:10 collection-4–1195417548931681886.wt
-rw-r–r– 1 root root 36K Jan 4 13:11 sizeStorer.wt
-rw-r–r– 1 root root 68K Jan 4 13:11 WiredTiger.wt
-rw-r–r– 1 root root 948 Jan 4 13:11 WiredTiger.turtle
drwxr-xr-x 3 root root 4.0K Jan 4 13:11 ./
drwxr-xr-x 2 root root 4.0K Jan 4 15:49 diagnostic.data/
#
#
#ll -lhtr /home/srinivas/mongodb-3.2/data/shard1_1/diagnostic.data/
total 640K
drwxr-xr-x 3 root root 4.0K Jan 4 13:11 ../
-rw-r–r– 1 root root 616K Jan 4 15:45 metrics.2016-01-04T06-25-19Z-00000
-rw-r–r– 1 root root 11K Jan 4 15:49 metrics.interim
drwxr-xr-x 2 root root 4.0K Jan 4 15:49 ./
#
#
#ll -lhtr /home/srinivas/mongodb-3.2/data/shard2_1/
total 17M
drwxr-xr-x 16 root root 4.0K Jan 4 11:55 ../
-rw-r–r– 1 root root 21 Jan 4 11:55 WiredTiger.lock
-rw-r–r– 1 root root 49 Jan 4 11:55 WiredTiger
-rw-r–r– 1 root root 4.0K Jan 4 11:55 WiredTigerLAS.wt
-rw-r–r– 1 root root 5 Jan 4 11:55 mongod.lock
-rw-r–r– 1 root root 95 Jan 4 11:55 storage.bson
-rw-r–r– 1 root root 16K Jan 4 11:56 index-3-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 index-1-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 collection-2-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 11:56 collection-0-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 index-8-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 collection-7-118778076845854607.wt
-rw-r–r– 1 root root 16K Jan 4 12:02 index-6-118778076845854607.wt
-rw-r–r– 1 root root 32K Jan 4 12:04 collection-5-118778076845854607.wt
-rw-r–r– 1 root root 36K Jan 4 12:52 _mdb_catalog.wt
-rw-r–r– 1 root root 2.0M Jan 4 13:04 index-11-118778076845854607.wt
-rw-r–r– 1 root root 1.5M Jan 4 13:04 index-10-118778076845854607.wt
-rw-r–r– 1 root root 4.7M Jan 4 13:04 collection-9-118778076845854607.wt
-rw-r–r– 1 root root 8.4M Jan 4 13:04 collection-4-118778076845854607.wt
-rw-r–r– 1 root root 36K Jan 4 13:05 sizeStorer.wt
-rw-r–r– 1 root root 68K Jan 4 13:05 WiredTiger.wt
-rw-r–r– 1 root root 948 Jan 4 13:05 WiredTiger.turtle
drwxr-xr-x 3 root root 4.0K Jan 4 13:05 ./
drwxr-xr-x 2 root root 4.0K Jan 4 15:49 diagnostic.data/
#
#ll -lhtr /home/srinivas/mongodb-3.2/data/shard2_1/diagnostic.data/
total 616K
drwxr-xr-x 3 root root 4.0K Jan 4 13:05 ../
-rw-r–r– 1 root root 590K Jan 4 15:46 metrics.2016-01-04T06-25-19Z-00000
-rw-r–r– 1 root root 11K Jan 4 15:49 metrics.interim
drwxr-xr-x 2 root root 4.0K Jan 4 15:49 ./
#
#
#cat /home/srinivas/mongodb-3.2/data/shard2_1/WiredTiger.lock
WiredTiger lock file
#
#cat /home/srinivas/mongodb-3.2/data/shard2_1/WiredTiger
WiredTiger
WiredTiger 2.7.0: (November 19, 2015)
#
#cat /home/srinivas/mongodb-3.2/data/shard2_1/mongod.lock
2876
#

 

 

  • Ask Question