Minimum permission for using mongodump (to dump a specific db)

前端 未结 4 1439
不知归路
不知归路 2021-02-01 16:59

We can\'t seem to find any conclusive document on what permissions (user roles) are required to run mongodump on a specific db.

Say I have a db named

4条回答
  •  太阳男子
    2021-02-01 17:47

    Bad memory for me too. But finally figure it out... Actually it's so simple. You just need to add a user with the backup role for mongodump and restore role for mongorestore.

    backup role: Provides minimal privileges needed for backing up data. This role provides sufficient privileges to use the MongoDB Cloud Manager backup agent, Ops Manager backup agent, or to use mongodump to back up an entire mongod instance.

    restore role: Provides privileges needed to restore data from backups that do not include system.profile collection data. This role is sufficient when restoring data with mongorestore without the --oplogReplay option.

    For example, you can create a backup user like this:

    > use admin
    > db.createUser({
        user: "backupuser",
        pwd: "12345",
        roles: ["backup"]
    })
    

提交回复
热议问题