Main process exited, code=exited, status=1/FAILURE after adding keyFile and replSetName

After Adding keyFile and replSetName in the conf file I get error when trying to start mongod.
“mongod.service: Main process exited, code=exited, status=1/FAILURE”
And If I do not add them mongod starts fine.

This is my conf file:

# 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:
#  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:
security:
  authorization: enabled
  keyFile: /var/lib/mongodb/pki/rs-keyfile
  
#operationProfiling:

#replication:
replication:
   replSetName: setIntegration

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

Please share the content of the log file.

Share the output of the commands:

ls -ld /var/lib/mongodb
ls -ld /var/log/mongodb/mongod.log
ls -ld /var/lib/mongodb/pki/rs-keyfile

log file is empty.

commands output:
username@px-ss-intg-mdb1:~$ ls -ld /var/lib/mongodb
drwxr-xr-x 4 mongodb mongodb 4096 Mar 27 08:17 /var/lib/mongodb
username@px-ss-intg-mdb1:~$ ls -ld /var/log/mongodb/mongod.log
-rw------- 1 mongodb mongodb 6377384 Mar 27 08:17 /var/log/mongodb/mongod.log
username@px-ss-intg-mdb1:~$ ls -ld /var/lib/mongodb/pki/rs-keyfile
-rw------- 1 username username 1004 Mar 24 12:02 /var/lib/mongodb/pki/rs-keyfile

I changed the owner for the file and it worked

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.