You might want to also review this post
https://sudonix.org/topic/389/mongodb-backup-script
@ahmed the database needs to be running to use MongoDump.
Nodebb.org documentation states that Mongodb must be stopped before backup
nodebb.org documentation should be updated
I think I saw it wrong
I will try as you say
@ahmed I never stop the database when backing up. Never did it with mysql either. I’m not saying it’s right but it’s always worked for me and the backup schedules I’ve created for others who have used that to perform recovery.
I’m trying to take a backup while Mongodb is running, but this time it gives an authentication error.
root@localhost:~# mongodump --port 27017 -u "nodebb" -p "Em26452645" --db=nodebb --out=backup/ahmed
2024-03-24T19:15:41.690+0300 Failed: can't create session: failed to connect to mongodb://localhost:27017/: connection() error occurred during connection handshake: auth error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed.
root@localhost:~#
root@localhost:~#
root@localhost:~#
root@localhost:~# mongodump
2024-03-24T19:15:54.554+0300 Failed: error creating intents to dump: error getting database names: (Unauthorized) Command listDatabases requires authentication
@ahmed are you backing up remotely?
Try this - obviously, substitute where necessary to match your environment
mongodump -u root --password 'secret' --authenticationDatabase admin
@phenomlab
I think it finally happened
mongodump --port 27017 -u "nodebb" -p "Em26452645eses" --db=nodebb --out=backup/ahmed
2024-03-24T20:39:20.788+0300 writing nodebb.sessions to backup/ahmed/nodebb/sessions.bson
2024-03-24T20:39:20.792+0300 done dumping nodebb.sessions (21 documents)
2024-03-24T20:39:20.805+0300 writing nodebb.objects to backup/ahmed/nodebb/objects.bson
2024-03-24T20:39:20.811+0300 done dumping nodebb.objects (714 documents)