Mongodb backup failed, added user with read and write permissions, but prompt verification failed, read and write data is normal, ask for advice

this is the case. Everything is normal for mongodb under Ubuntu, authentication is enabled, and all users created by users are normal and can be verified. The following information shows the three users I created. It also connects to, (nodejs normally when using it, but it doesn"t work when it comes to data backup. Ask the boss to point out what the problem is

.
root@vueblog:/blog/backup-sharp sudo mongodump -h 127.0.0.1 -d blog -u blogUser -p blogUser -o /blog/backup/
2018-07-31T02:33:44.213+0100    
// 
Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.


> use admin
switched to db admin
> db.auth("blogUser","blogUser")
1  //

// 
> db.auth("blogAdmin","blogAdmin")
1
> db.system.users.find().pretty()
{
"_id" : "admin.blogAdmin",
"user" : "blogAdmin",
"db" : "admin",
"credentials" : {
    "SCRAM-SHA-1" : {
        "iterationCount" : 10000,
        "salt" : "LezWgtwzcQdUGJNQHk/PrA==",
        "storedKey" : "JMq+WDKQUM+F6psaYkJ4A64ICvc=",
        "serverKey" : "wjVtJeXI+cSOkL/hRea/XMOnsHM="
    }
},
"customData" : {
    
},
"roles" : [
    {
        "role" : "userAdminAnyDatabase",
        "db" : "admin"
    }
]
}
{
"_id" : "admin.blogUser",
"user" : "blogUser",
"db" : "admin",
"credentials" : {
    "SCRAM-SHA-1" : {
        "iterationCount" : 10000,
        "salt" : "i0pAWh218NJZOg31QUw6Mg==",
        "storedKey" : "NKiBdk7pjS6xfGVWfZ0+ymcBQv8=",
        "serverKey" : "jN7OYs4t3NNwANlfdPfa7FMW3ug="
    }
},
"customData" : {
    
},
"roles" : [
    {
        "role" : "readWrite",
        "db" : "blog"
    }
]

}
{

"_id" : "admin.blogSession",
"user" : "blogSession",
"db" : "admin",
"credentials" : {
    "SCRAM-SHA-1" : {
        "iterationCount" : 10000,
        "salt" : "BMpvRaJAp6vb/u41AuvWHA==",
        "storedKey" : "PygM60Xwykru10P2FvUcYQwkvoQ=",
        "serverKey" : "2bqPumdwUOMu0491TZdxo/ujris="
    }
},
"customData" : {
    
},
"roles" : [
    {
        "role" : "readWrite",
        "db" : "session"
    }
]
}
Apr.01,2021

try this: sudo mongodump-h 127.0.0.1-d blog-u blogUser-p blogUser-- authenticationDatabase admin-o / blog/backup/

Menu