I’m attempting to add an additional member to an existing replica set on one of our clusters. I’ve created a data base user that has readWriteAnyDatabase, dbAdminAnyDatabase & clusterMonitor. However, when I go to perform the below command in Pymongo… config = client.admin.command('replSetGetConfig') I receive the below error… (Unauthorized) not authorized on admin to execute command.
The role clusterMonitor has been explicitly added to this user. According to the documentation, that should be enough access to run the replSetGetConfig command.
Is your cluster self hosted or is it running on MongoDB Atlas? MongoDB Atlas does not allow adding replica set members in this way. Replica set config needs to happen through the MongoDB Atlas website UI (or Atlas Administration API).
If this is self hosted then ensure your DB user is created in the admin database. You can verify the app is authenticated as the expected user by running the connectionStatus command:
Looking through the documentation (Deploy a Replica Set — MongoDB Cloud Manager, https://www.mongodb.com/docs/manual/tutorial/expand-replica-set/) - it’s not clear to me how I can add an additional member to an existing replica set within the Atlas UI. Is it possible to add a member in this way? The steps in the first link appear to be outdated, or my version of Atlas is an older version, ‘Create New Replica Set’ is not an option for me.