-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manual backup of Mongo database #6481
Comments
This isn't a meshcentral issue but a mongodb issue https://www.mongodb.com/docs/database-tools/mongodump/mongodump-examples/#output-to-an-archive-file It's not a zip file, but a mongodump file, so u can't open it with windows explorer |
Hello, I see, in that case the backup file created when I perform a manual dump is different to the backup file created by an autobackup. |
I will try have a look tomorrow when i get chance. |
Hello, No urgency on that. Thanks. Now that I understand that the manual backup file is different to the auto-backup - and therefore is probably valid. I'll try restoring the backup. The reason for the ticket was that I thought that the backup file was no good. Curious as to the difference in the size of the backup files though. |
Hello, I modified the backup command as follows: The backup appeared to complete OK. I then tried to restore the database on another VM. I'm trying to move the MeshCentral host. I stopped the meshcentral service and issued the command: The restore appears to have failed: I say this, because although all the hosts have appeared in the MeshCentral portal, only a handful are connecting with the endpoints. C:\Program Files\MongoDB\Server\7.0\bin>mongorestore --archive=C:\MeshCentral\meshcentral-backups\meshcentral-backup-2024-10-29.archive 2024-10-29T13:19:08.762+1100 preparing collections to restore from |
Wondering if these instructions are relevant: If using MongoDB, copy the backup.archive back, make sure to clean up any existing “meshcentral” How to run "mongo" ? |
Endpoints with MeshAgents are connecting to the restored MeshCentral server. However no AMT agents are connecting to the restored MeshCentral server. |
If autobackup is configured, the db dumpfile created with mongodump (or any other dump for that matter) is put in the zipfile afterwards. The zip is the dump file including the meshcentral-data directory. This also contains your signed-agents directory, which makes it large. The shown autobackup file is corrupt, which can happen as there are a few paths to failure in the zipfile creation function. The archiver module does not resume for example after a warning and leaves an unfinished zipfile. @si458 I'm in the process of fixing this and a few other to-do's there and adding some backup options. As soon as it's finished and checked I'll do a PR. |
@PTR-inc I haven't looked at the autobackup feature in a while, but it could indeed be a bug, so thank u for having a look! I'm very busy at the moment with personal life things, so look at things when I get a chance |
Hello, I have updated to 1.1.33 Unfortunately it doesn't appear to have made any difference to the errors I'm observing. Here is a partial extract of the log. For some reason I can't pipe the output of mongorestore to a txt file and there is too much output for the cmd prompt |
This is the command I'm entering C:\Program Files\MongoDB\Server\7.0\bin>mongorestore --archive=C:\MeshCentral\meshcentral-backups\meshcentral-autobackup-2024-11-04-10-51\mongodump-2024-11-04-10-51.archive |
@ZENAdmin-Ops the PR didn't get merged into 1.1.33, it just missed it!
|
C:\MeshCentral>npm install Ylianst/MeshCentral |
Oh yeh on windows u must have |
Is it possible to trigger an autobackup? |
Go into the my server tab then console tab and type |
There is no mongo archive in the autobackup |
are you running the latest 1.1.33 or are you using the master repo which includes the new backup features? |
This version |
what does your config.json look like? like above? edit: i just tested mongodb here on mac and it backups up fine, with the .archive file inside the zip folder |
config.json is as per above And previously worked fine with the mongodb archive included in the zip file |
works perfectly fine here too with your style config
after checking source code the is alot of console.log |
Can you advise the location of the log file? |
|
I don't have that folder. Can you provide an example filename for a log, I can use that to search. |
i dont use the meshcentral installer so im not sure im afraid i cant remember |
With one slash autobackup creates an autobackup file, but there is no archive backupconfig says all the right things in the console, but no backup file is created. Also backupconfig causes the service to stop |
you have given like 3 different things here with like 3 different setups? the must be something wrong with your setup, |
With two slashes autobackup creates an autobackup file, but no archive backupconfig says all the right things in the console
Different commands, produce different results Entirely logical autobackup is one command backupconfig is another command |
With two slashes autobackup creates an autobackup file, but there is no archive backupconfig says all the right things in the console, but no backup file is created. With two slashes, backupconfig does not stop the Meshcentral service |
I'm happy for you to connect in to troubleshoot. Send me an e-mail when you're ready, and if I'm around I will respond. |
The slashes need to be this way "/" or the Web portal doesn't work While the service was running with some of the other things we tried above, the Web portal was offline |
Just checked with my windows test setup and mongodb. I am using mongo v8 btw, but that should not be an issue. |
C:\MeshCentral>node node_modules\meshcentral |
NOTE: THIS LINE BELOW IS A BUG! YOU CAN IGNORE IT! FIX IS HERE, BAD PR ON MY PART! 0ec8b06
@ZENAdmin-Ops plz email me when u get chance i lost ur email address haha |
Uuurgh.. '\' should be '\\' ofcourse...always preview a comment lesson learned (again) Can you show the content of the backup zipfile? There should be a .archive file in the meshcentral-data folder if there is no error in the console. |
There isn't. |
just updating this issue, after connecting to the computer in question, |
Ah ok, I put the db archive file in the meshcentral-data folder for backup convenience so all base meshcentral data is together. |
@PTR-inc would you mind plz!? |
Sure! |
Signed-off-by: si458 <[email protected]>
Ah yes, my bad. I tested all the dbdumps, not the nedb one with that last change. Thanks |
@PTR-inc hey no worries we all live and learn! |
Hello, I'm still getting the same error with the restore as before. I'm wondering if these instructions are relevant: If using MongoDB, copy the backup.archive back, How to run "mongo" ? |
@ZENAdmin-Ops where are you seeing those instructions? |
I found those instructions from another ticket. But I'm not clear on how to perform them. |
i use mongodb compass as its a nice gui front end of my mac which might help u |
Thanks that was a big help. Restore appears to have worked. I'll confirm by updating the DNS and see if endpoints connect successfully. |
A number of the mesh agents have connected, but none of the AMT agents have connected. I'm not going to be able to troubleshoot this until this evening my time, because users will be using the computers, so I won't be able to connect to the endpoints. Perhaps a restart of the endpoint will be needed to 'refresh' the AMT agent. |
@ZENAdmin-Ops this question gets asked alot about how to |
The existing AMT agents weren't connecting because I messed up the NAT entries at the new site. FM. So many things to check. So this ticket can be closed. Thanks for your assistance. |
Describe the bug
I'm trying to perform a manual backup of the Mongo DB.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect a valid database backup.
Screenshots
Output from mongodump command appears successful:
2024-10-29T08:51:59.624+1100 done dumping admin.system.version (1 document)
2024-10-29T08:51:59.624+1100 writing meshcentral.events to archive 'C:\MeshCentral\meshcentral-backups\meshcentral-backup-2024-10-29.zip'
2024-10-29T08:51:59.645+1100 writing meshcentral.serverstats to archive 'C:\MeshCentral\meshcentral-backups\meshcentral-backup-2024-10-29.zip'
2024-10-29T08:51:59.651+1100 writing meshcentral.meshcentral to archive 'C:\MeshCentral\meshcentral-backups\meshcentral-backup-2024-10-29.zip'
2024-10-29T08:51:59.657+1100 writing meshcentral.power to archive 'C:\MeshCentral\meshcentral-backups\meshcentral-backup-2024-10-29.zip'
2024-10-29T08:51:59.673+1100 done dumping meshcentral.meshcentral (228 documents)
2024-10-29T08:51:59.698+1100 done dumping meshcentral.serverstats (410 documents)
2024-10-29T08:51:59.700+1100 done dumping meshcentral.events (5827 documents)
2024-10-29T08:51:59.700+1100 done dumping meshcentral.power (136 documents)
However refer screenshot of backup directory. The size of the manual backup is substantially smaller than the autobackups.
Also unable to open the manual backup file, while I can open the auto backup files.
Server Software (please complete the following information):
Additional context
Add any other context about the problem here.
Your config.json file
The text was updated successfully, but these errors were encountered: