I have a mongodb cluster(1 mongos, mongo config replica set with 2 members, 1 shard with 3 members) and I have enabled internal authentication in config replica set. Also my backend code connects to mongos instance.
Currently, there is no authentication on login to mongos instance. Now, I want to enable username and password login on mongos.
After I run config replica set members using
security:
keyFile: /path/to/keyfile
they work properly. But mongos does not work anymore. The command to run mongos is:
sudo mongos --configdb configRepl/cfg1.example.com:27019,cfg2.example.com:27019 --bind_ip_all --port 20200 --syslog --syslogFacility local4 --timeStampFormat iso8601-local -vvvvv --keyFile /path/to/keyfile
With command above mongos will not work and exits, bu witouht --keyFile /path/to/keyfile
it will not fork and work.
I have created a user before enabling authentication. All mongodb instances are version 4.4 .
I would be very thankful if ou help me.
transitionToAuth: true
If your application accepts downtime follow Update Sharded Cluster to Keyfile Authentication which is a bit simpler