Database Reference
In-Depth Information
or possibly this one:
Unable to acquire lock for lockfilepath: /data/db/mongod.lock, terminating
In either case, you can solve the problem by opening up permissions in the data direc-
tory using chmod or chown .
U NABLE TO BIND TO PORT
MongoDB runs by default on port 27017. If another process, or another mongod , is
bound to the same port, you'll see this error:
listen(): bind() failed errno:98
Address already in use for socket: 0.0.0.0:27017
There are two possible solutions to this. The first is to find out what other process is
running on port 27017 and then terminate it. Alternatively, run mongod on a different
port using the --port flag. Here's how to run MongoDB on port 27018:
mongod --port 27018
A.2
Basic configuration options
Here I present a brief overview of the flags most commonly used when running
MongoDB.
--dbpath —The path to the directory where the data files are to be stored. This
defaults to /data/db .
--logpath —The path to the filename where log output should be directed.
Log output will be printed to standard output ( stdout ) by default.
--port —The port that MongoDB listens on. If not specified, this is set to
27017.
--rest —This flag enables a simple REST interface that enhances the server's
default web console. The web console is always available 1,000 port numbers
above the port the server listens on. Thus if the server is listening at localhost
on port 27017, then the web console will be available at http://localhost:28017/.
Spend some time exploring the web console and the commands it exposes, as
you can discover a lot about a live MongoDB server this way.
--fork —Detaches the process to run as a daemon. Note that fork only works
on Unix variants. Windows users seeking similar functionality should look at the
instructions for running MongoDB as a proper Windows service. These are
available at mongodb.org.
Those are the most important of the MongoDB startup flags. Here's an example of
their use on the command line:
$ mongod --dbpath /var/local/mongodb --logpath /var/log/mongodb.log
--port 27018 --rest --fork
Search WWH ::




Custom Search