Platform configuring backups - kwantu/platformconfiguration GitHub Wiki

back #Platform configuring backups

Copy the backup scripts into place

/usr/local/bin/mysql_local_backup.sh
/usr/local/bin/mysql_check_backup_sizes.sh
/usr/local/bin/lockrun.sh
/usr/local/bin/lockrun

Update the password and settings in the scripts.

Create the backup directories

mkdir /var/backups
mkdir /var/backups/mysqldumps_offsite
mkdir /var/backups/mysqldumps

Fix MySQL error for information_schema

mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM GLOBAL_STATUS': The 'INFORMATION_SCHEMA.GLOBAL_STATUS' feature is disabled; see the documentation for 'show_compatibility_56' (3167) Sun Jan 17 16:36:28 SAST 2021 - Dumping database 'information_schema' FAILED To fix it, add the show_compatibility_56 = 1 option to the [mysqld] section of the MySQL configuration file (/etc/mysql/my.cnf).

cd /etc
chmod 777 my.cnf

...
[mysqld]
show_compatibility_56 = 1 
...
chmod 400 my.cnf
systemctl restart mysqld

Dropbox

cd ~
wget https://github.com/dropbox/dbxcli/releases/download/v3.0.0/dbxcli-linux-amd64
cd /usr/local/bin/
mv /root/dbxcli-linux-amd64 dbxcli
chmod 755 dbxcli



###Dropbox-Uploader
``` bash
Install from github
cd /opt
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
cd Dropbox-Uploader
chmod +x dropbox_uploader.sh

Then run it the first time to set up all the authentication parameters 1 Open the following URL in your Browser, and log in using your account: https://www.dropbox.com/developers/apps (make sure that you log in with the kwantu backup userid) 2 Click on "Create App", then select "Choose an API: Scoped Access". We create an app for each server - use the server url 3 "Choose the type of access you need: App folder" 4 Enter the "App Name" that you prefer (e.g. MyUploader289921445028549), must be uniqe 5 Now the new configuration is opened, switch to tab "permissions" and check "files.metadata.read/write" and "files.content.read/write" Now, click on the "Submit" button. 6 Now to tab "settings" and provide the following information: ... follow the instructions ...

./dropbox_uploader.sh

Then test the dropbox connection

./testUnit.sh

Then run the following command to upload the first test

/opt/Dropbox-Uploader/dropbox_uploader.sh  -s -h upload /var/backups/mysqldumps_offsite /var/backups

Mongo backup

mongodump -d cms -o /var/backups/mongodb

Then upload to dropbox

/opt/Dropbox-Uploader/dropbox_uploader.sh  -s -h upload /var/backups/mongodb /var/backups

Couchdb Config Backup

Find the configs files

/usr/bin/find /usr/local/data/couchdb/data/ -type f -name "kwantu_configs*"
cp /usr/local/data/couchdb/data/shards/80000000-ffffffff/kwantu_configs.1604242320.couch /var/backups/couchdb/80000000-ffffffff/
cp /usr/local/data/couchdb/data/shards/00000000-7fffffff/kwantu_configs.1604242320.couch /var/backups/couchdb/00000000-7fffffff/

Find the taxonomy files

/usr/bin/find /usr/local/data/couchdb/data/ -type f -name "kwantu_taxonomies*"
cp /usr/local/data/couchdb/data/shards/80000000-ffffffff/kwantu_taxonomies.*.couch /var/backups/couchdb/80000000-ffffffff/
cp /usr/local/data/couchdb/data/shards/00000000-7fffffff/kwantu_taxonomies.*.couch /var/backups/couchdb/00000000-7fffffff/

Then upload to dropbox

/opt/Dropbox-Uploader/dropbox_uploader.sh  -s -h upload /var/backups/couchdb /var/backups

##Duplicity backup Install

yum install epel-release -y && yum install duplicity -y