Backup

From SWKLS WIKI
Jump to navigation Jump to search

MySQL

Auto MySQL Backup

  • Login to server via SSH and change user to root
sudo -i
  • Download the AutoMySQL backup tar file.
wget https://swkls.org/tmp/automysqlbackup-v3.0_rc6.tar.gz
  • Create a directory in /opt and extract the downloaded file.
mkdir /opt/automysqlbackup
mv automysqlbackup-v3.0_rc6.tar.gz /opt/automysqlbackup/
cd /opt/automysqlbackup
tar -zxvf automysqlbackup-v3.0_rc6.tar.gz

After the extraction install the AutoMySQL backup ./install.sh You can use the default path for the global configuration directory and the directory for the executable. You only need to press the “Enter” key when the paths are required.

After the installation, you have to configure AutoMySQL backup. Open the configuration file with your favorite text editor. vi /etc/automysqlbackup/automysqlbackup.conf

Uncomment and set the following configuration directives: CONFIG_mysql_dump_username='root' CONFIG_mysql_dump_password='YourPassword' CONFIG_mysql_dump_host='localhost' CONFIG_backup_dir='/var/backup/db' CONFIG_do_monthly="01" CONFIG_do_weekly="5" CONFIG_rotation_daily=6 CONFIG_rotation_weekly=35 CONFIG_rotation_monthly=150 CONFIG_mysql_dump_port=3306 CONFIG_mysql_dump_use_separate_dirs='yes' CONFIG_mysql_dump_compression='gzip' CONFIG_db_exclude=( 'information_schema' 'performance_schema' ) You can configure the AutoMySQL backup by changing the values according to your needs.

Create a directory for the MySQL backups. In the configuration we have mentioned the directory /backup/db. mkdir /var/backup mkdir /var/backup/db To run the AutoMySQL backup execute the following command. /usr/local/bin/automysqlbackup If you want you can schedule the AutoMySQL backups to run on a specific time by creating a cronjob. crontab -e

Add Line: 0 2 * * * /usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf Here the backup is scheduled at 2 AM.

Synology Basic NAS Setup create shared folder 'backups', no recycle bin if used for staff backups create user 'backupuser' create 'staff' group give 'staff' group rw to 'backups' folder, add 'backupuser' to 'staff' group set notifications swkls+synologynas@mycheckcentral.cc mail.checkcentral.cc 587 install 'Cloud Sync' and 'Storage Analyzer' packages enable power-on after power failure & WOL enable basic SSH Email Alerts swkls+synologynas@mycheckcentral.cc

mail.checkcentral.cc

587