Reputation: 11
I just setup a 3 node MongdoDB cluster with replicasets and made a novice mistake. I setup the replica set etc first and then was being fancy and setup the default admin user as below:
show users { "_id" : ObjectId("blah"), "user" : "admin", "pwd" : "blah", "roles" : [ "userAdminAnyDatabase" ] }
This is fine for basic admin but I cannot do any replica set commands as the role is not cluster admin:
rs.status() { "ok" : 0, "errmsg" : "unauthorized" }
I tried a few things
db.users.update({'user':'admin'}, {$addToSet: {'roles' :'clusterAdmin'}}) not authorized for update on admin.users
Upvotes: 1
Views: 3165