this mongodb.conf drives me crazy. Whatever I try I cannot create a user because of it needs authentication. If I disable authentication in the mongod.conf file with # and restart mongod it still dies not work to create the admin user because of that requiresauthentication error message. Any idea whatelse I could do to fix that?
The main issue with your steup is that you have 4 instances of mongod running.
Since ping local gives an error there is no way to know where you connect with mongosh mongodb:/local.
You are running some mongod as root. You should not run any server as root.
Sine it looks like you are trying to do m103 exercises, I would recommend you use the IDE. The IDE strats with a fresh VM and you do not hand up with things from previous lab.
I suspect that you have already created a user by doing a prevovious lab. To ease hurdles the lab instructions assume a given setup which you might not gave on your machine. You will not be able to create a new user if one exists unless you authenticate.
You should stop all mongod running on your system and use the IDE until you are familiar enough to put back your system in working health.
next, disable (comment out) security in all your config files.
then, one by one, check your config files, and make notes of the ports you have used. run each config file independently of each other and see if they run. then if they start, connect to them with mongo --port 27xxx using the port number of that config file. since you run them all in the same machine, you don’t need to use --host 120.0.0.1 portion.
act cautiously because you are using 4 different ports: 27011, 27012, 27013, and 27017. omitting the port number will connect you to the wrong instance.
when done, kill the one you have tested from the terminal or execute a shutdown while in the mongo shell.
after making sure that all of your config files do work, you can then try enabling security. but obey the procedure adding the security. doing it in the wrong order will prevent your instances from starting (so you will also know where the problem is).
But Still I am getting this error: 2023-10-19T07:37:38.546+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
[/quote]