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.

有帮助吗?

解决方案

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.

其他提示

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"`

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),
许可以下: CC-BY-SA归因
不隶属于 dba.stackexchange
scroll top