尝试备份 Mongo 数据库时出错

尝试备份 Mongo 数据库时出错

我在尝试备份 mongo 独立数据库时遇到了同样的错误:

Failed: error connecting to db server: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.

大多数其他答案都指向添加--authenticationDatabase=admin,但这并不能解决我的问题。

我尝试了几种不同的方法基本上相同的操作,但都出现了相同的错误:

# mongodump --host 192.168.43.67:27017 -u "<USERNAME>" -p '<PASSWORD>'  --authenticationDatabase "admin"
# mongodump --host 192.168.43.67 -u "<USERNAME>" -p '<PASSWORD>' --out /var/backups/mongobackups/$(date +'\%y-\%m-\%d') 
# mongodump --host 192.168.43.67:27017 --username <USERNAME> --password '<PASSWORD>' --authenticationDatabase admin --db <DBNAME> --out /var/backups/mongobackups/$(date +'\%y-\%m-\%d') 
# mongodump mongodb://<USERNAME>:<PASSWORD>@192.168.43.67:27017
# mongodump --host=192.168.43.67 --port=27017 --username=<USERNAME> --authenticationDatabase=admin --out=/var/backups/mongobackups/$(date +'\%y-\%m-\%d') 

我的密码确实包含一个特殊字符,一个@符号。

配置非常简单:

#mongodb.conf - generated from Puppet
#System Log
systemLog.path: /var/log/mongodb/mongodb.log
systemLog.destination: file
systemLog.logAppend: true
systemLog.quiet: false
systemLog.verbosity: 2

#Process Management
processManagement:
pidFilePath: /var/run/mongod.pid

#Storage
storage.dbPath: /var/lib/mongodb

#Security
security.authorization: enabled

#Net
net.bindIp:  0.0.0.0

我可以通过运行以下命令成功进入 shell:

mongo -u <USERNAME> -p <PASSWORD> 192.168.43.67/<DBNAME> --authenticationDatabase "admin"

版本信息:

# apt list --installed | grep mongo
mongo-tools/focal,now 3.6.3-0ubuntu1 amd64 [installed]
mongodb-org-server/focal,now 5.0.6 amd64 [installed,upgradable to: 5.0.10]
mongodb-org-shell/focal,now 5.0.6 amd64 [installed,upgradable to: 5.0.10]

# mongodump --version
mongodump version: built-without-version-string

答案1

get the "mongodb-database-tools"  after update to this version error was gone

相关内容