...
MongoDB(4.0.2) I want to run my mongodb with auth. I made changes to mongo,conf file but when I restart mongodb with Sudo service mongod restart It Shows : ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2019-07-25 07:42:53 UTC; 9s ago Docs: https://docs.mongodb.org/manual Process: 8859 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=2) Main PID: 8859 (code=exited, status=2) Jul 25 07:42:53 ip-172-31-18-221 systemd[1]: Started MongoDB Database Server. Jul 25 07:42:53 ip-172-31-18-221 mongod[8859]: Unrecognized option: security Jul 25 07:42:53 ip-172-31-18-221 mongod[8859]: try '/usr/bin/mongod --help' for more information Jul 25 07:42:53 ip-172-31-18-221 systemd[1]: mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Jul 25 07:42:53 ip-172-31-18-221 systemd[1]: mongod.service: Unit entered failed state. Jul 25 07:42:53 ip-172-31-18-221 systemd[1]: mongod.service: Failed with result 'exit-code'. But if I start with sudo mongod --auth --dbpath=/var/lib/mongodb command. It run ok. Mongo.conf # mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # Where and how to store data. storage: dbPath: /var/lib/mongodb journal: enabled: true # engine: # mmapv1: # wiredTiger: # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 27017 bindIp: 0.0.0.0 # how the process runs processManagement: timeZoneInfo: /usr/share/zoneinfo security: authorization: "enabled" #operationProfiling: #replication: #sharding: ## Enterprise-Only Options: Thanks in Advance
udayaditya.singh@gmail.com commented on Fri, 26 Jul 2019 05:33:41 +0000: Hello Guys, I hit one command, and magically it starts working. sudo chown mongodb.mongodb -R /var/lib/mongodb Thanks for support