Backup: Difference between revisions

From SWKLS WIKI
Jump to navigation Jump to search
(Created page with "==MySQL== ===Auto MySQL Backup=== * Login to server via SSH and change user to root <syntaxhighlight lang=bash line start="1"> sudo -i </syntaxhighlight> Download the AutoMySQ...")
 
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:
===Auto MySQL Backup===
===Auto MySQL Backup===
* Login to server via SSH and change user to root
* Login to server via SSH and change user to root
<syntaxhighlight lang=bash line start="1">
<syntaxhighlight lang="bash" line start="1">
sudo -i
sudo -i
</syntaxhighlight>
</syntaxhighlight>
Download the AutoMySQL backup tar file.
* Download the AutoMySQL backup tar file.
<syntaxhighlight lang="bash" line start="1">
wget https://swkls.org/tmp/automysqlbackup-v3.0_rc6.tar.gz
wget https://swkls.org/tmp/automysqlbackup-v3.0_rc6.tar.gz
Create a directory in /opt and extract the downloaded file.
</syntaxhighlight>
* Create a directory in /opt and extract the downloaded file.
<syntaxhighlight lang="Bash" line start="1">
mkdir /opt/automysqlbackup
mkdir /opt/automysqlbackup
mv automysqlbackup-v3.0_rc6.tar.gz /opt/automysqlbackup/
mv automysqlbackup-v3.0_rc6.tar.gz /opt/automysqlbackup/
cd /opt/automysqlbackup
cd /opt/automysqlbackup
tar -zxvf automysqlbackup-v3.0_rc6.tar.gz
tar -zxvf automysqlbackup-v3.0_rc6.tar.gz
After the extraction install the AutoMySQL backup
</syntaxhighlight>
* After the extraction install the AutoMySQL backup
<syntaxhighlight lang="Bash" line start="1">
./install.sh
./install.sh
</syntaxhighlight>
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.
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.
* After the installation, you have to configure AutoMySQL backup. Open the configuration file with your favorite text editor.
<syntaxhighlight lang="Bash" line start="1">
vi /etc/automysqlbackup/automysqlbackup.conf
vi /etc/automysqlbackup/automysqlbackup.conf


Line 33: Line 40:
CONFIG_mysql_dump_compression='gzip'
CONFIG_mysql_dump_compression='gzip'
CONFIG_db_exclude=( 'information_schema' 'performance_schema' )
CONFIG_db_exclude=( 'information_schema' 'performance_schema' )
</syntaxhighlight>
You can configure the AutoMySQL backup by changing the values according to your needs.
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.
* Create a directory for the MySQL backups. In the configuration we have mentioned the directory /backup/db.
<syntaxhighlight lang="Bash" line start="1">
mkdir /var/backup
mkdir /var/backup
mkdir /var/backup/db
mkdir /var/backup/db
To run the AutoMySQL backup execute the following command.
</syntaxhighlight>
* To run the AutoMySQL backup execute the following command.
<syntaxhighlight lang="Bash" line start="1">
/usr/local/bin/automysqlbackup
/usr/local/bin/automysqlbackup
If you want you can schedule the AutoMySQL backups to run on a specific time by creating a cronjob.
</syntaxhighlight>
* If you want you can schedule the AutoMySQL backups to run on a specific time by creating a cronjob.
<syntaxhighlight lang="Bash" line start="1">
crontab -e
crontab -e


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


Synology
==Synology==
Basic NAS Setup
===Basic NAS Setup===
create shared folder 'backups', no recycle bin if used for staff backups
* create shared folder 'backups', no recycle bin if used for staff backups
create user 'backupuser'
* create user 'backupuser'
create 'staff' group
* create 'staff' group
give 'staff' group rw to 'backups' folder, add 'backupuser' to 'staff' group
* give 'staff' group rw to 'backups' folder, add 'backupuser' to 'staff' group
set notifications
* set notifications
swkls+synologynas@mycheckcentral.cc
* swkls+synologynas@mycheckcentral.cc
mail.checkcentral.cc
* mail.checkcentral.cc
587
* 587
install 'Cloud Sync' and 'Storage Analyzer' packages
* install 'Cloud Sync' and 'Storage Analyzer' packages
enable power-on after power failure & WOL
* enable power-on after power failure & WOL
enable basic SSH
* enable basic SSH
Email Alerts
* enable DDNS (synology). Use verso_code+nas i.e. haconas for name
* enable automatic package updates
 
==Email Alerts==
<blockquote class="inform">
swkls+synologynas@mycheckcentral.cc
swkls+synologynas@mycheckcentral.cc


Line 66: Line 84:


587
587
</blockquote>
[[Category:Meta]]

Latest revision as of 15:36, 12 June 2020

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
  • enable DDNS (synology). Use verso_code+nas i.e. haconas for name
  • enable automatic package updates

Email Alerts

swkls+synologynas@mycheckcentral.cc

mail.checkcentral.cc

587