一 问题描述
备份时,报错:
[root@mongodb-server ~]# mongoexport -uroot -proot -d test -c log -h 192.168.100.60 --port 27017 -o /root/log.json
2020-07-07T12:59:49.881+0800 error connecting to db server: server returned error on SASL authentication step: Authentication failed.
二 解决办法
添加–authenticationDatabase admin
如下:
[root@mongodb-server ~]# mongoexport -d test -c log -h 192.168.100.60 --port 27018 --authenticationDatabase admin --file /root/log.json
2020-07-07T13:11:38.949+0800 connected to: 192.168.100.60:27018
2020-07-07T13:11:39.220+0800 imported 20000 documents
版权声明:本文为weixin_45537987原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。