Recovering or changing replica set password

I inherited a mongoDB replica set running mongo 4.2.25 that is associated with a graylog cluster (syslog management software). In order to update other parts of the graylog cluster I need to update the mongo replica set. The issue is that I don’t have any documentation for the actual mongo admin password, only the password for the actual graylog db user. Is there any way I can recover or reset the password for a mongo replica set, or am I going to have to remove and re-create the entire thing?
This is running on RHEL 8 on a three-node cluster.
Here is my mongod.conf file


# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true
#  engine:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1,10.0.0.2 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


security:
  keyFile: /var/lib/mongo/mongodb-keyfile
  authorization: enabled
  

#operationProfiling:

replication:
  replSetName: rs01

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:
type or paste code here

Hi @Danny_McCaslin and welcome to the community!
If I understand correctly your question, you can use this workaround:

I hope it is useful!

Best regards

The problem is that when I comment out the security parameter the primary shows itself as a secondary when I log in and I still can’t add a user. I get a response from the server

"not master and slaveOk=false"
``

Hi @Danny_McCaslin,
You need to :

  • comment the security parameter in all the instance that compose the replica set
  • restart the instance to apply the changes
  • point to the primary instance for create user and repeat the step in reverse.

Regards

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