0

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.

Szymon Jeż
  • 3,267
  • 3
  • 16
  • 17

1 Answers1

3

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, the mongorestore utility effectively contains the mongod binary which allows it to act as a mongod and insert to data files without a mongod running already. The advantage a solo mongorestore usually has is that it won't be doing anything else whereas usually a running mongod will be replicating or servicing other operations besides the mongorestore.

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 a mongorestore (or a mongodump for that matter). Therefore, with an eye on the future, running a mongod and using that to perform the restore would be the advisable method to use.

Adam C
  • 5,132
  • 2
  • 28
  • 49