Security authorization has a duplicate entry in /etc/mongod.conf

hello,
vagrant@m103:/etc$ mongod -f /etc/mongod.conf
Error parsing YAML config: duplicate key: security.authorization(canonical key: security.authorization)

/etc/mongod.conf has security authorization two times. shall I change the owner and update the file? or will support help?

here is info from config file…

security:
authorization: enabled

security:
authorization: enabled

thanks
Madan

Please remove one entry
Nothing will happen
If you are unsure take backup of original file before editing it

cp /etc/monod.conf /etc/mongod.conf.orig
You may need sudo privs
why duplicate entry is there?May be added to test students

workaround:

copy the file to another directory where user has rw permissions. remove one entry and also add fork: true (under processManagement)

i m unable to fix this please help

I CONTROL [main] log file “/data/logs” exists; moved to “/data/logs.2019-05-17T09-58-36”.

i got this error if i change the directory of config file

this is the error in my terminal

It is not a error just a warning that another mongod.log exists and moving to old
I see you are starting mongod2
Did you start mongod1 also?
By any chance are you using same name for both mongod’s under same path
Check the log what it says
Try to connect to mongo instance

I experienced this too, so I used sudo and then removed the last entry using vi editor.

In any case, executing it after the change too threw another error (file related error). I didn’t bother running it again, as the instructions below the video mentioned that whatever was showcased in the lecture was only for understanding and not to be experimented as environment is a bit different…

1 Like