I'm upgrading to 3.0 and ran into some issues with the upgrade. Specifically, I got an error when trying to start up mongod
via ssh
, it tried to use the default dbpath
instead of the one I specified in my new YAML config file. I went ahead and rebooted the machine and now mongod
is up and running again. I'm a bit paranoid at this point and would like to know if there's a way to make sure the storage engine is wiredtiger
from the shell.
3 Answers
Easiest way to find the storage engine being used currently.
Inside mongo console type
db.serverStatus().storageEngine
It returns the storage engine being used currently
{ "name" : "wiredTiger" }
Once it is confirmed that wiredTiger is being used then type
db.serverStatus().wiredTiger
to get all the configuration details of wiredTiger.
-
2
-
db.serverStatus().storageEngine for this command I got output as wiredTiger. But wiredTiger section is missing when I run db.serverStatus() and also many other metrices are missing. mongodb version is 4.4.4 I am using mongodb Atlas and connecting through following command: mongo "mongodb+srv://cluster0.4dkyu.mongodb.net/admin" --username veeresh1 Jan 19, 2022 at 13:04
-
I got answer to the doubt I had. There are some limitations on free cluster and M2/M5 shared clusters. reference link Jan 25, 2022 at 4:28
DISCLAIMER : Not a MongoDB Expert
Check the process list in Linux
WIREDTIGER_CONFIGURED=`ps -ef|grep mongod|grep -i storageengine|grep -ic wiredtiger`
echo ${WIREDTIGER_CONFIGURED}
1 means it's there
From the mongo shell
db.serverStatus()
You should see something like this
"wiredTiger" : {
...
"cache" : {
"tracked dirty bytes in the cache" : <num>,
"bytes currently in the cache" : <num>,
"maximum bytes configured" : <num>,
"bytes read into cache" :<num>,
or you can just pull the storage engine name with
db.serverStatus().storageEngine.name
You will either get mmapv1
or wiredTiger
or from the command line
MONGO_ENGINE=`mongo -u... -p... --eval "db.serverStatus().storageEngine.name"`
-
I'm on ubuntu, so I tried the Linux command and it showed 0, but the db.serverStatus() shows a wiredTiger node. Apr 2, 2015 at 18:30
-
well either way, the db.serverStatus is encouraging. with this i'll go ahead and update my other servers and put in a ticket with mongo for a definitive answer. Apr 2, 2015 at 18:32
-
-
2@chaitanya.varanasi Please look at the other answer. It has what you want. For the sake of clarity, I will say this: If you are running MongoDB 3.x, just run
db.serverStatus().storageEngine.name
. It will either saymmapv1
orwiredTiger
. Jan 25, 2016 at 23:43 -
1Grepping for the
--storageEngine
parameter only works in limited situations, e.g. MongoDB 3.0 where the parameter is explicitly provided on the command line. Typicallymongod
configuration values are provided in a configuration file so they won't appear in theps
output. In MongoDB 3.2+ WiredTiger is the default storage engine so no additional parameter is required. The recommended approach to use is your second suggestion ofdb.serverStatus().storageEngine.name
via themongo
shell. FYI, if you happen to be using MongoDB 2.6 or older this won't work: the only storage engine was MMAP.– StennieDec 6, 2016 at 6:10
The mongod.log
file gets populated by a string which describes what storage engine you're using;
so you could run:
cat /var/log/mongodb/mongod.log | grep STORAGE | tail -n 1
which returns something like:
2017-06-28T21:45:24.745+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),