mirror of
https://github.com/krislamo/puppet-rsnapshot
synced 2024-11-10 00:00:35 +00:00
Merge branch 'hotfix/update_docs'
- Update README to reflect changes in configuration of backup_scripts - Add example backup_scripts to README
This commit is contained in:
commit
dcd5f532a9
41
README.md
41
README.md
@ -372,7 +372,7 @@ Default is:
|
|||||||
$backup_scripts = {
|
$backup_scripts = {
|
||||||
mysql => {
|
mysql => {
|
||||||
dbbackup_user => 'root',
|
dbbackup_user => 'root',
|
||||||
dbbackup_password => 'myFancyPassWord',
|
dbbackup_password => 'myPassWord',
|
||||||
},
|
},
|
||||||
psql => {
|
psql => {
|
||||||
dbbackup_user => 'postgres',
|
dbbackup_user => 'postgres',
|
||||||
@ -398,6 +398,8 @@ rsnapshot::hosts:
|
|||||||
backup_scripts:
|
backup_scripts:
|
||||||
mysql:
|
mysql:
|
||||||
psql:
|
psql:
|
||||||
|
dbbackup_user: 'backupuser'
|
||||||
|
dbbackup_password: 'password'
|
||||||
bazqux:de:
|
bazqux:de:
|
||||||
backup_scripts:
|
backup_scripts:
|
||||||
mysql:
|
mysql:
|
||||||
@ -409,6 +411,43 @@ This creates
|
|||||||
- a mysql and a psql backup script for `foobar.com` using the credentials `dbbackup:hunter2` for mysql and `dbbackup:yeshorsebatterystaple` for psql
|
- a mysql and a psql backup script for `foobar.com` using the credentials `dbbackup:hunter2` for mysql and `dbbackup:yeshorsebatterystaple` for psql
|
||||||
- a mysql backup script for `bazqux.de` using the credentials `myuser:mypassword`
|
- a mysql backup script for `bazqux.de` using the credentials `myuser:mypassword`
|
||||||
|
|
||||||
|
The scripts look like this:
|
||||||
|
mysql:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
host=bazqux.de
|
||||||
|
user=myuser
|
||||||
|
pass=mypassword
|
||||||
|
|
||||||
|
dbs=( $(mysql -h "$host" -u "$user" -p"$pass" -e 'show databases' | sed '1d;/information_schema/d;/performance_schema/d') )
|
||||||
|
|
||||||
|
for db in "${dbs[@]}"; do
|
||||||
|
mysqldump --host="$host" --user="$user" --password="$pass" --single-transaction --quick --routines --ignore-table=mysql.event "$db" > "$db".sql
|
||||||
|
wait
|
||||||
|
pbzip2 -p3 "$db".sql
|
||||||
|
done
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
psql:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
host=foobar.com
|
||||||
|
user=backupuser
|
||||||
|
pass=password
|
||||||
|
|
||||||
|
PGPASSWORD="$pass"
|
||||||
|
dbs=( $(psql -h "$host" -U "$user" -Atc "SELECT datname FROM pg_database WHERE NOT datistemplate AND datname <> 'postgres'") )
|
||||||
|
|
||||||
|
for db in "${dbs[@]}"; do
|
||||||
|
ssh -l root "$host" "pg_dump -U ${user} -Fc ${db}" > "$db".sql
|
||||||
|
wait
|
||||||
|
pbzip2 -p3 "$db".sql
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### rsnapshot configuration variables
|
### rsnapshot configuration variables
|
||||||
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
|
Please read up on the following in the [rsnapshot manpage](http://linux.die.net/man/1/rsnapshot)
|
||||||
|
Loading…
Reference in New Issue
Block a user