mongod.conf yaml file format example

Connect with

mongod.conf is a configuration file in mongoDB which is being used to read by mongodb server while startup. So, when you run service mongod start command on linux termincal , mongodb read this property from /etc/mongod.conf by mongoDB server.

There are 2 different fomrat first, text file which is being used upto mongod version 3.0, and another YAML/YML format being used mongod 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 usually installed in CentOS flavour of linux and found mongod.conf configuration file under /etc/. It’s not hard and fast to create under /etc folder, it depends upone , OS and its flavour, in Linux (centos) you can view by following command and customize as per your need.

 vi /etc/mongod.conf

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



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

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