Hi.
I use MongoDB Atlas M20 instance.
I had an issue with huge oplog size(50GB) with storage auto scale option enabled.
So I turned off auto scaling and set Maximum Oplog Size as 990MB to prevent oplog size going to large.
Next, I wanted to run compact command on oplog collection to make disk size smaller but failed to run with authentication failed message.
{
"message" : "not authorized on local to execute command { compact: 'oplog.rs', $clusterTime...
I found related articles but nobody seems to have an authentication issue like me.
Iâm facing the same issue, and i have tried creating the custom role (allowing compact operation on local database) through the Atlas UI and the shell without success. I have read that atlasAdmin does not have write permissions on local and config databases as stated in https://www.mongodb.com/docs/atlas/mongodb-users-roles-and-privileges/#built-in-roles. Does anyone know how to achieve so? Is it something support has to do for you?
Finally, after paying for support, i was sent an article with all the necessary steps.
The main issue the OP (and myself ) where having, is that the âdbAdminâ role has to be specifically added on âlocalâ database as a Custom Role, and then assign it to the user performing the actions on the DB.
This doesnât appear on the community documentation, and it would be nice to add it for future reference.
Then you can issue the compact command as db.runCommand({compact: âoplog.rsâ}) on the secondaries. For the primary, you will have to use the Test Failover feature, then proceed as with the secondaries.
Finally after scouring the internet and the LLMs, I come across this post. Thank you TomĂĄs, with this information I was able to create a custom role with dbAdmin@local, then assign this role to my admin user, then run db.runCommand({compact: âoplog.rsâ}) on local. Everything else I found on the internet was saying you canât get that permission on Atlas, and you need to open a support ticket.
Thanks again for bringing this information to the community!