mongodump from remote node - unable to authenticate using mechanism “SCRAM-SHA-256”

烈酒焚心 提交于 2021-02-11 13:41:45

问题


Tried taking dump from a remote node and got the following error:

Failed: can't create session: could not connect to server: connection(): auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed.

Tried two methods to take dump from the remote node. But got the same error in both the methods.

# Method 1
mongodump -h remoteip@port -u xxx -p xxx --db xxx --authenticationDatabase xxx

# Method 2
mongodump --uri "mongodb://username:password@remoteip:port/db?authSource=xxx"

How to resolve this?


回答1:


I had the same issue. In my case, the password has special characters. It works with single quote for password:

-p 'my_password'



回答2:


I had the same problem and solved it using single quotes in the password like this:

   --password 'secret'



回答3:


Was in the same spot that you are, solved it this way:

mongodump --uri "mongodb+srv://username:password@yourmongodbclustersourceurl" --archive \
mongorestore --uri "mongodb+srv://username:password@yourmongodbclusterdestinationurl" --archive \
--nsExclude "admin.system.*"

Needless to mention, you just need to change your username, password and the url in this formula and voila. Good luck.




回答4:


For me (trying to use mongodump on a single node DB on the same host), using --authenticationDatabase admin did the trick:

mongodump -u root --password 'secret' --authenticationDatabase admin -d mongo-dev -o /tmp/dump-2020-11-27.bson


(courtesy of mongodump from remote node - unable to authenticate using mechanism "SCRAM-SHA-256")



来源:https://stackoverflow.com/questions/62797865/mongodump-from-remote-node-unable-to-authenticate-using-mechanism-scram-sha-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!