Site icon Tutorial

Run-time Database Configuration

Run-time Database Configuration

The command line and configuration file interfaces provide MongoDB administrators with a large number of options and settings for controlling the operation of the database system. This document provides an overview of common configurations and examples of best-practice configurations for common use cases.

While both interfaces provide access to the same collection of options and settings, this document primarily uses the configuration file interface. If you run MongoDB using a control script or installed from a package for your operating system, you likely already have a configuration file located at /etc/mongodb.conf. Confirm this by checking the contents of the /etc/init.d/mongod or /etc/rc.d/mongod script to ensure that the control scripts start the mongod with the appropriate configuration file. To start a MongoDB instance using this configuration issue a command in the following form:

mongod –config /etc/mongodb.conf

mongod -f /etc/mongodb.conf

Modify the values in the /etc/mongodb.conf file on your system to control the configuration of your database instance.

Configure the Database – Consider the following basic configuration:

fork = true

bind_ip = 127.0.0.1

port = 27017

quiet = true

dbpath = /srv/mongodb

logpath = /var/log/mongodb/mongod.log

logappend = true

journal = true

For most standalone servers, this is a sufficient base configuration. It makes several assumptions, but consider the following explanation:

Given the default configuration, some of these values may be redundant. However, in many situations explicitly stating the configuration increases overall system intelligibility.

Security Considerations – The following collection of configuration options are useful for limiting access to a mongod instance. Consider the following:

bind_ip = 127.0.0.1,10.8.0.10,192.168.4.24

nounixsocket = true

auth = true

Consider the following explanation for these configuration decisions:

Apply for MongoDB Certification Now!!

https://www.vskills.in/certification/databases/mongodb-server-administrator

Back to Tutorial

Exit mobile version