35

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.

61

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
    Just to confirm, this works on Windows, too. – Chris Paton Sep 2 '15 at 11:50
9

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. – ton.yeung Apr 2 '15 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. – ton.yeung Apr 2 '15 at 18:32
  • any update on this? I still get a 0 when I run this. – chaitanya.varanasi Jan 25 '16 at 21:51
  • 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 say mmapv1 or wiredTiger. – RolandoMySQLDBA Jan 25 '16 at 23:43
  • Grepping for the --storageEngine parameter only works in limited situations, e.g. MongoDB 3.0 where the parameter is explicitly provided on the command line. Typically mongod configuration values are provided in a configuration file so they won't appear in the ps 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 of db.serverStatus().storageEngine.name via the mongo shell. FYI, if you happen to be using MongoDB 2.6 or older this won't work: the only storage engine was MMAP. – Stennie Dec 6 '16 at 6:10
1

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),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.