Getting Mongodb and MYSQL Backups

February 07, 2019
Getting Mongodb and MYSQL Backups

This post will guide you through the process of getting mongodb and MYSQL database backups.


After ssh'ing and logging into the server do the following steps.

Mongodb

  • Create a backup directory
        
            mkdir /backup
            mkdir /backup/mongodb
        
    

  • Copy the Backup to the directory
        
            mongodump --out /backup/mongodb
        
    


If you are hosting Comstice Desktop Agent License Server Locally

  • Create a backup directory
        
            mkdir /backup
            mkdir /backup/mysql
        
    

  • Copy the Backup to the directory
        
            mysqldump -u root -p --all-databases > /backup/mysql/dump.sql
        
    
  • Enter database password when prompted


Use an ftp client to retrieve the backup folder and keep the backups somewhere safe

To restore backups the following commands are used

  • Copy the backup folder to the root folder on the server with an ftp client and run the following commands
        
            mongorestore /backup/mongodb
        
    

        
            mysql -u root -p --all-databases < /backup/mysql/dump.sql
        
    

Success!