Gentoo's portage downloads the source code and then compiles the binaries locally, you may want to look to where portage caches the downloads, presumably in /usr/portage/distfiles/mongodb*
for any files that are included in the source code tarball.
It looks like instead of changing the init script, you should be making the change to the config file.
You mentioned that you have a /etc/conf.d/mongodb
file - and I can see from there that a variable is being set, named MONGODB_DATA - if you set that value to /data/db
, then the variable in the init script should fill correctly upon startup.
For reference, this line:
--dbpath ${MONGODB_DATA:-/data/db} \
means that the init script will try to set the --dbpath command line option to whatever the contents of MONGODB_DATA
are, and if it is nothing, then use the path specified, as denoted. Something like this:
${A_CONFIG_FILE_OPTION:-/a/default/when/config/does/not/set/the/option}
Please note - this is not something that is mongodb related, or really even gentoo packaging, rather gentoo init script and configuration file.
A more comprehensive guide on mongodb configuration files (not gentoo's config file!) can be found here: http://www.mongodb.org/display/DOCS/File+Based+Configuration
Best Answer
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.