[SERVER-42413] Mongod service start issue Created: 25/Jul/19  Updated: 06/Dec/22  Resolved: 26/Jul/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: udayaditya Singh Assignee: Backlog - Triage Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mongodb: 4


Assigned Teams:
Server Triage
Operating System: ALL
Participants:

 Description   

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

 

 



 Comments   
Comment by udayaditya Singh [ 26/Jul/19 ]

Hello Guys,

I hit one command, and magically it starts working.

sudo chown mongodb.mongodb -R /var/lib/mongodb

Thanks for support

Generated at Thu Feb 08 05:00:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.