Database Reference
In-Depth Information
^C
Sun Jun 13 13:40:26 got kill or ctrl c signal 2 (Interrupt), will terminate after current cmd ends
...
Sun Jun 13 13:40:26 dbexit: really exiting now
Reconfiguring a Server
MongoDB supplies three main methods for configuring the server. First, you can use command-line options in
conjunction with the mongod server daemon. Second, you can do so by loading a configuration file. And third, you can
change most of these settings using the setParameter command. For example, we can change the logLevel back to
the default of 0 with the following command:
> db.adminCommand( {setParameter:1, logLevel:0 } )
Most of the prepackaged MongoDB installers use the latter method, using a file that is normally stored in /etc/
mongodb.conf on Unix/Linux systems.
You can change the configuration of your server by editing this file and restarting your server. The contents of this
file look like this:
# mongodb.conf
dbpath=/var/lib/mongodb
logpath=/var/log/mongodb/mongodb.log
logappend=true
auth = false
#enable the rest interface
rest =true
You enable an option by removing the # code from the front of the option and setting its value as you require it, as
any line starting with # is considered to be a “comment” and is thus ignored.
Placing any of the following option values in the configuration file is the same as specifying
--<optionname> <optionvalue>
on the command line when starting up MongoDB:
dbpath : Indicates where MongoDB will store your data; you should make sure it is on a fast
storage volume that is large enough to support your database size.
logpath : Indicates the file that MongoDB will store its logs in. The standard place to put this is
/var/logs/mongodb/mongodb.log ; you need to use logrotate to rotate this logfile and prevent
it from filling up your server's drive.
logappend : Setting this option to false causes the logfile to be cleared each time MongoDB is
started up. Setting this option to true causes all log entries to be appended to the end of any
existing logfile.
auth : Enables or disables the authentication mode on MongoDB server; see the discussion
earlier in this chapter for more information on authentication.
rest : Enables or disables the rest interface to MongoDB. You must enable this interface if you
want to use the links from the web-based status display to show additional information, but
this is not advised for production servers, as all of this information should be available via the
Mongo shell.
 
Search WWH ::




Custom Search