Getting an error when running a MongoDB dump when DB authentication is enabled
Original Question or Issue:
When creating a MongoDB dump, an error is encountered and the mongodump command fails to complete.
Environment:
- Product - FileCloud Server
- Version - Any
- Platform - Any
Steps to Reproduce:
Error or Log Message:
mongodump.exe --out C:\mongodump
2024-11-09T08:43:37.251-0600 Failed: error getting database names: not authorized on admin to execute command { listDatabases: 1, $readPreference: { mode: "secondaryPreferred" }, $db: "admin" }
Defect or Enhancement Number:
Cause:
The DB user used do not have the complete permission to create a mongodump of the entire FileCloud database in one command.
Resolution or Workaround:
As a workaround, you can create a mongodump on the individual Tonido Cloud databases. See the commands below:
mongodump --host <IP or Hostname of primary MongoDB node> --authenticationDatabase admin --username <dbusername> --password <yourpassword> --db=tonidosyncdb --out D:\mdump
mongodump --host <IP or Hostname of primary MongoDB node> --authenticationDatabase admin --username <dbusername> --password <yourpassword>--db=tonidoauditdb --out D:\mdump
mongodump --host <IP or Hostname of primary MongoDB node> --authenticationDatabase admin --username <dbusername> --password <yourpassword>--db=tonidoclouddb --out D:\mdump
mongodump --host <IP or Hostname of primary MongoDB node> --authenticationDatabase admin --username <dbusername>--password <yourpassword>--db=tonidosettings --out D:\mdump
mongodump --host <IP or Hostname of primary MongoDB node> --authenticationDatabase admin --username <dbusername>--password <yourpassword>--db=tonidostoragedb --out D:\mdump
Notes: