一 问题描述
备份时,报错:
[root@mongodb-server ~]# mongoexport -uroot -proot -d test -c log -h 192.168.100.60 --port 27017 -o /root/
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/
2020-07-07T13:11:38.949+0800 connected to: 192.168.100.60:27018
2020-07-07T13:11:39.220+0800 imported 20000 documents