Mongodb cluster backup

I followed the mongodb documents for my cluster backup. http://docs.mongodb.org/manual/tutorial/backup-sharded-cluster-with-database-dumps/

When I tried to take backup of my relpicaset. The secondary node in the replicaset is not getting shutdown. I am getting following error.

   root@local:/$ mongo --port 22222 -u admin -p admin --authenticationDatabase admin --eval 'printjson(db.adminCommand("shutdown"))'
    {
            "ok" : 0,
            "errmsg" : "unauthorized: this command must run from localhost when running db without auth"
    }

The admin user role is "userAdminAnyDatabase". I can not take backup if it is up. Please advise

Upvotes: 0

Views: 183

Answers (1)

Jerry
Jerry

Reputation: 8111

Since you are dealing with the Cluster backup its recommended to use clusterAdmin role to backup the data.Also provide the readaccess for the required database.

db.grantRolesToUser("backupUser", [{role: "clusterAdmin", db:"admin"}])

Upvotes: 0

Related Questions