What and how much is it faster:
#mongod not running
mongorestore --dbpath /var/lib/mongodb --db test /some_dump
or
#mongod running
mongorestore --db test /some_dump
?
I could not quickly find an answer on the web and have no time now to do a benchmark.
For now at least, they are basically equivalent, assuming the
mongod
is not doing anything else significant. To explain, in versions 2.6 and below, themongorestore
utility effectively contains themongod
binary which allows it to act as amongod
and insert to data files without amongod
running already. The advantage a solomongorestore
usually has is that it won't be doing anything else whereas usually a runningmongod
will be replicating or servicing other operations besides themongorestore
.From version 2.8 onward, this will no longer be the case (unless something changes, 2.8 is not yet released as of writing this), and you will be required to have a
mongod
running in order to perform amongorestore
(or amongodump
for that matter). Therefore, with an eye on the future, running amongod
and using that to perform the restore would be the advisable method to use.