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:
# where to write logging data.
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
# Where and how to store data.
  dbPath: /var/lib/mongo
    enabled: true

  engine: "wiredTiger"
#  mmapv1:
      cacheSizeGB: 4

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

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

#  authorization: 'enabled'
#  keyFile: /opt/mongodb/keyfile
  replSetName: rs1
#  oplogSize=1024
## Enterprise-Only Options


You can visit 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 Comment

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