mongod.conf yaml file format example

Connect with

mongod.conf yaml file format examplemongod.conf YAML or mongod.conf YML is a configuration file in mongoDB, which is being used to provide configuration seetting by MongoDB DBA and read by mongodb database engine while startup.

1. Overview of mongod.conf YAML

When we run service mongod start command on linux terminal , mongodb database engine read this property from /etc/mongod.conf.

There are 2 different format first, a text file which is being used up to mongod version 3.0, and another YAML/YML format being used MongoDB version greater than 3.0, so in this article, I tried to demonstrate YAML file format with minimum properties. However, you can customize as per your need. When you installed MongoDB in Linux OS, by default mongod.conf file creates under /etc foloder i.e. /etc/mongod.conf.
I usually installed in CentOS flavor of Linux and REDHAT and found mongod.conf configuration file under /etc/. It’s not hard and fast to create under /etc folder, it depends upon , OS and its flavour, in Linux (centos) you can view by the following command and customize as per your need.

 vi /etc/mongod.conf

2. Sample mongod.conf yaml file format

# mongod.conf
# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true

  engine: "wiredTiger"
#  mmapv1:
  wiredTiger:
    engineConfig:
      cacheSizeGB: 4

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017
#  bindIp: 0.0.0.0  # Listen to local interface only, comment to listen on all interfaces.

#security:
#  authorization: 'enabled'
#  keyFile: /opt/mongodb/keyfile
#operationProfiling:
replication:
  replSetName: rs1
#  oplogSize=1024
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:

Reference

You can visit docs.mongodb.com for more details.

Thanks for visiting this post for mongod.conf yaml file format. You can also visit MongoDB Tutorial Listing page for more articles on MongoDB document-oriented database.
Your comments are welcome to improve this post.


Connect with

2 thoughts on “mongod.conf yaml file format example”

  1. Pingback: radha

Leave a Reply to Srini Cancel Reply

Your email address will not be published. Required fields are marked *