2014-12-05 114 views
0

我跟踪了mongodb文档以进行群集备份。 http://docs.mongodb.org/manual/tutorial/backup-sharded-cluster-with-database-dumps/Mongodb群集备份

当我试图采取我的relpicaset备份。复制套件中的辅助节点没有关闭。我得到以下错误。

[email protected]:/$ 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" 
    } 

admin用户角色是“userAdminAnyDatabase”。如果它已启动,我无法进行备份。请指教

+0

从错误消息中,您未启用授权启用的mongod(例如在命令行上使用--auth),因此无法远程关闭它。您需要在启用auth的情况下重新启动它,并为远程关机创建适当的用户。 – wdberkeley 2014-12-10 20:07:22

+0

是的wdberkeley我没有运行--auth。其实我正在部署MongoDB群集。所以我需要启动所有的mongodb实例,并启用--auth。在开始之后,我需要对dbs进行一些操作,例如引发rs等。对于那些我需要首先创建用户还是不需要? – 2014-12-12 08:10:04

回答

0

既然你正在处理的集群备份其推荐使用clusterAdmin角色来备份data.Also提供所需的数据库访问read

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