Added elkarbackup CT
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
#!/bin/ash
|
||||
#Shoud be uploaded in Elkarbackup under scrips and set ran as Job Pre and Post
|
||||
ssh -oStrictHostKeyChecking=no $(echo $ELKARBACKUP_URL | sed 's|:.*||') bash /opt/Elkar-MysqlBackup.sh "$ELKARBACKUP_EVENT"
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
##Should be as "/opt/Elkar-MysqlBackup.sh" on the MySQL server
|
||||
## MysqlUser needs following Global privilleges: SELECT, PROCESS, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW
|
||||
USER="<MysqlUserName>"
|
||||
PASSWORD="<MysqlUserPassword>"
|
||||
OUTPUT="/tmp/mysqlBCK"
|
||||
|
||||
PRE () {
|
||||
mkdir $OUTPUT
|
||||
ExcludeDatabases="Database|information_schema|performance_schema|mysql|sys"
|
||||
databases=$(mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | egrep -v $ExcludeDatabases)
|
||||
|
||||
for db in $databases; do
|
||||
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
|
||||
echo "Dumping database: $db"
|
||||
mysqldump -u $USER -p$PASSWORD --databases $db > $OUTPUT/$db.sql
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
POST () {
|
||||
rm -rf /tmp/mysqlBCK
|
||||
}
|
||||
|
||||
$1
|
||||
25
CT-Files/elkarbackupALP/Extras/MySQLBackup/ReadMe.md
Normal file
25
CT-Files/elkarbackupALP/Extras/MySQLBackup/ReadMe.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# MySQL backup tool for Elkarbackup
|
||||
|
||||
## Explanation
|
||||
* Elkarbackup server runs `MySQLBackup-RemoteTrigger.sh` before starting the backup to login to the target (MySQL) server to run `MySQLBackup-Tool.sh` with the PRE argument.
|
||||
This will ask remote mysql to dump all databases to a SQL file to the local temporary backup location (default: /tmp/mysqlBCK)
|
||||
* Elkarbackup will store the temporary backup location
|
||||
* Elkarbackup server runs `MySQLBackup-RemoteTrigger.sh` after running the backup to login to the target (MySQL) server to run `MySQLBackup-Tool.sh` with the POST argument.
|
||||
This will ask the remote to clean the temporary backup location
|
||||
|
||||
## Setup
|
||||
|
||||
### Steps on MySQL Server
|
||||
* Make sure SSH server is running
|
||||
1. Add the SSH public key from root@elkarbackupServer and elkarbackupAPP(Downloaded from cogwheel/settings icon > Manage parameters)
|
||||
2. Create a Mysql user with the following Global privilleges: `SELECT, PROCESS, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW`
|
||||
be carefull with special charactes in the password
|
||||
3. Save `MySQLBackup-Tool.sh` to `/opt/Elkar-MysqlBackup.sh`
|
||||
4. Update the variables in `/opt/Elkar-MysqlBackup.sh` to the newly created user
|
||||
|
||||
## Steps Elkarbackup WebUI
|
||||
1. Under `script` tab add the `MySQLBackup-RemoteTrigger.sh` with `Run as` option Before and After Job
|
||||
2. Under `Jobs` tab add the MySQL server as Client
|
||||
3. Under `Jobs` tab> + on the mysql client to add job
|
||||
4. Set Path to the temporary backup location (default: /tmp/mysqlBCK)
|
||||
Pre and Post sctipt to the just created `script`
|
||||
Reference in New Issue
Block a user