How to use mongo after enabling authorization in config file in windows

Hello, I am using a windows machine for MongoDB.
I am trying to test replica set creation as per the course, which have authorization enabled under security in config file. But:-
When I enable the authorization under security in config file and restart the system mongodb simply stops running in the background, and I am not being able to start mongodb from cmd.

I have also tried “net start MongoDB” in cmd which doesn’t work while authorization is enabled. How am I suppose to auth my root level credentials when MongoDB is not even running in the background?

What all parameters you added?
What error you get.Any details in the logs?
Instead of disturbing default mongod running on your Windows you can spin up your own mongods on command line and do the testing for the replica

mongod --port 28000 --dbpath xyz --logpath xyz --auth
Refer to mongo doc for more details

Hi, Thanks for your previous help.
As I was going forward I came to more issues, like openssl was needed when security is enabled for replication. So I decided not to use security while testing the replica set deployment.
Now I have created config files for all three nodes. but not able to start even the first node using the config file.
I also tried different editing approach to resolve the issue like changing bindIP from to my local system’s ip address
I am attaching a screenshot of my config file and the commands I used in CMD. In CMD you would also be able to see the error which is “Unrecognized option: t.$data”

It is not t.$data
Error says t.$date Check if you have used any other invalid parameter

1 Like

Nice observation which make thinks that we do not have the whole picture about what is being done.

You wrote

but you show 1 configuration file that does not have any suffix or prefix that indicates that this is the configuration for replica set member 1, 2 or 3. The dbpath and systemlog.path also specify a general location rather than a member specific location.

You have an error that say t.$date while you write t.$data. But there is no presence of anything that looks like that in your configuration file. So, I suspect that mongod is a wrapper script around the real mongod command that tries to manipulate the single configuration file in order to generate member specific configuration. The error probably comes from your wrapper script.

This or we do not see the complete configuration file.

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