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.
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:
Your comments are welcome to improve this post.