Hi Anil,
MongoDB Configuration Files use YAML format and it is independent of the platform you are using.
Please note that YAML format works on MongoDB 2.6 and above.
Below is the sample configuration file that I tried on my system which runs mongod instance on port 27017 on wiredTiger storage engine:
mongod --config /etc/mongod.conf
# SystemLog sets the destination to which all log output has to be sent
# Set the path of the log file
# Appends new entries to the end of the existing log file
systemLog:
destination: file
path: "/var/log/mongodb/mongod.log"
logAppend: true
# Storage sets the directory where mongod instance stores its data
# Enables journaling
# and runs on Wired Tiger storage engine
storage:
dbPath: "/data/db/"
journal:
enabled: true
engine:
wiredTiger
# Net sets the IP address and TCP port for mongod instance
net:
bindIp: 127.0.0.1
port: 27017
# fork and run in background
# location of pid file
processManagement:
fork: true
pidFilePath: "/var/run/mongodb/mongod.pid"
You can create it accordingly for your system.
Above config file will be same as working with command line options:
mongod —port 27017 —bind_ip 127.0.0.1 —dbpath /data/db —journal —storageEngine wiredTiger —logpath /var/log/mongodb/mongod.log —logappend —fork
Please note that :
1) The above configuration file sample will fork the mongod process into the background, and the mongod logs will be accessible from /var/log/mongodb/mongod.log as specified in systemLog.path setting.
2) These settings require writing data or files to /var/log, /var/run, /data/db . Make sure you are authorised to have write permissions to do so.
Regards,
Pooja