Learning Activity: Implementing Internal Authentication

Hi All,
I tried to complete Chapter 3 of M150 Learning Activity: Implementing Internal Authentication but getting this error message. What am I doing wrong…?

Indentation issues
Use one space after keyfile
Do not add authorization

Thanks for your swift response, I have tried that but no luck…

Earlier it was yaml indentation issue
Now it is issue with one of the parameter
Did you check mongod.log or run it without fork option
Most likely some permission issue or dirpath/logpath issue

Thanks for your response. This issue has been fixed.

Please can someone tell what I’m missing here…?


Try to run without fork as suggested in the error.It will throw error on your terminal as to why it is failing with exit 1
Most likely permissions or wrong path for logpath/dirpath directories

Below is the error message I’m getting again, please advise…

user@M103# mongod -f mongod.conf
2022-11-02T04:02:06.896+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open “/data/log/mongod.log”

below is the configuration file, could you please confirm if it looks good…?

storage:
  dbPath: /data/db
systemLog:
  logAppend: true
  path: /data/log/mongod.log
  destination: file
replication:
  replSetName: M103
net:
  bindIp : localhost
  port: 27000
security:
  authorization: enabled
processManagement:
  fork: true

It says failed to open mongod.log
Does /data/log dir exists?
If yes does it have write privileges for mongod?
Show output of cd /data/log
ls -lrt /data

Below is for your information:

user@M103# cd /data/log
bash: cd: /data/log: No such file or directory
user@M103# ls -lrt /data
total 1
drwxr-xr-x    2 root     root             2 Nov  2 14:19 db
user@M103# mkdir -p /data/log
user@M103# cd /data/log
user@M103# ls lrt /data/log
ls: lrt: No such file or directory
/data/log:
user@M103# ls /data/log
user@M103# ls -lrt /data
total 1
drwxr-xr-x    2 root     root             2 Nov  2 14:19 db
drwxr-xr-x    2 root     root             2 Nov  2 14:20 log
user@M103#

Did mongod start after creating the missing directory?
Please follow your lab instructions.If they ask you to create dbpath/logpath in a specific path stick to it
If your are implementing internal authentication keyfile is needed which is missing in your config file
Review your lab steps again

Here is the error message showing up now:

user@M103# mongod --config mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 336
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
user@M103# mongod -f mongod.conf
user@M103# mongod --config mongod.conf
2022-11-02T18:04:24.923+0000 I CONTROL  [main] log file "/data/logs" exists; moved to "/data/logs.2022-11-02T18-04-24".
user@M103#

I have been able to fixed the issue, modified the configuration file as follow and it worked

storage:
  dbPath: /data/db
systemLog:
  path: /data/logs
  destination: file
  logAppend: true
net:
  bindIp: localhost
  port: 27000
security:
  authorization: enabled

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