yandyand

导航

统计

解决Docker中备份mongodb不成功问题。报错原因:error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1"

1.进入容器:
docker ps 
docker exec -it 容器名/ID bash 
备份mongodb命令:mongodump -h 172.19.19.41 --port 27017 -u='admin' -p='********' -d ******* -o ./backup/ 
出现报错:Failed: can't create session: could not connect to server: connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

解决方法:
添加参数:--authenticationDatabase admin

参数含义:

解释1.安全登录认证,mongodb本身的一种安全认证登录方式,参数就相当于指定admin数据库。

解释2.在连接mongo时,使用参数 --authenticationDatabase,会认证 -u 和 -p 参数指定的账户和密码。如果没有指定验证数据库,mongo使用连接字符串中指定的DB作为验证数据块。

修改后为:mongodump -h 172.19.19.41 --port 27017 --authenticationDatabase admin -u='admin' -p='*******' -d ******* -o ./backup/

ok!正常备份!

 

 

posted on   yandyand  阅读(7656)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示