Backup Services
This section describes how the OpenVino servers are backed up using rsync:
Â
Install rsync on all the servers:
[root@delta ~]# yum install rsync
alpha
Â
root@alpha$ ssh-keygen -t rsa
root@alpha$ scp .ssh/id_rsa.pub root@foxtrot:.ssh/authorized_keys_alpha
root@foxtrot$Â cat .ssh/authorized_keys_alpha >> .ssh/authorized_keys
Â
Setup the crontab entry for root@alpha
Â
0Â Â 3Â Â *Â Â *Â Â * Â rsync -avH --delete /home/mbarrow root@foxtrot:/backups/alpha
0Â Â 4Â Â *Â Â *Â Â * Â rsync -avH --delete /var/log root@foxtrot:/backups/alpha
10Â Â 5Â Â *Â Â *Â Â * Â rsync -avH --delete /var/www root@foxtrot:/backups/alpha
25Â Â 5Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/alpha
bravo
Â
OpenBravo backup configurations
From the page http://wiki.openbravo.com/wiki/Installation/Appliance/Config#Synchronization_of_backups
Â
To configure a backup policy follow these steps:
Edit the configuration file for backups
Set an schedule to perform the backups automatically
Synchronize copies of backups on different servers
Implement server redundancy.
Edit the configuration file to enable backups
Edit the file /etc/openbravo-backup.conf
Â
# Enable or disable the backups ( yes / no )
BACKUP_ENABLED="yes"
# Enable rotation of backups, this will mantain the number of backups specified and delete old ones
ROTATION_ENABLED="yes"
ROTATION_NUM_TO_MAINTAIN="40"
# This should be  <20GB of backups, and cover more than one monthly accounting period for Costaflores
# Enable the syncronization, this will run the specified plugins after a manual or auto backup
# Add the plugins space separated. Example: SYNC_PLUGINS_TO_RUN="sync-s3 sync-label"
# For custom sync scripts use: SYNC_PLUGINS_TO_RUN="/home/openbravo/backup-sync-methods/sync-custom"
SYNC_ENABLED="no"
SYNC_PLUGINS_TO_RUN=""
# Config for sync-s3 plugin
SYNC_S3_BUCKET="s3://BUCKET/openbravo-backups/"
# Config for sync-label plugin
SYNC_LABEL="backup-device"
SYNC_LABEL_PATH="openbravo-backups"
# Config for sync-samba plugin
SAMBA_USER=""
SAMBA_PASS=""
SAMBA_HOST=""
SAMBA_UUI=""
SAMBA_SHARED_FOLDER=""
SAMBA_SYNC_PATH=""
### ADVANCED OPTIONS ###
# COMPRESSION OPTIONS
# gz = quick and good compression
# bz2 = better compression but slower
# xz = very good compression but significatly slower
# none = without compression, the quickest but no compression
COMPRESSION_SOURCES="gz"
COMPRESSION_DUMP="gz"
### ALTERNATIVE PATHS ###
BACKUPS_DIR="/backups"
BACKUPS_TMP_DIR="/tmp"
### EMAIL OPTIONS ###
export EMAIL_FROM="somethingsomething@costaflores.com"
export EMAIL_TO="info@costaflores.com"
export EMAIL_SERVER="smtp.costaflores.com"
export EMAIL_PORT="587"
export EMAIL_TLS=True
export EMAIL_USER="somethingsomething@costaflores.com"
export EMAIL_PASSWORD="longpassword"
export EMAIL_ENVIRONMENT="Openvino"
export EMAIL_TEMP_FILE="/tmp/mailText.txt"
export EMAIL_SUBJECT="Error en el Backup de Openbravo. Entorno: "$EMAIL_ENVIRONMENT
### COPY ATTACHMENTS ###
export ATTACH_COPY="no"
Set an schedule to perform the backups automatically
Â
Edit the openbravo crontab entry, to execute an automatic backup everyday at 08:00. Currently, the timezone set for bravo is CET, so the is equivalent to 03:00 or 04:00 in Argentina/Uruguay (depending on European summer time), and should be the least invasive time for this operation, though even if it was at 08:00 in South America, Mica Vera is not likely to be inputing data at that time.
Â
# Openbravo backup
# The backups cofiguration are in /etc/openbravo-backups.conf
# Remove the comment mark '#' at the beggining of next line to enable the openbravo backups, put it back to disable the openbravo backups
 0  8  *  *  *   /usr/share/openbravo/backup/backup-auto
# ┬  ┬  ┬  ┬  ┬
# │  │  │  │  │
# │  │  │  │  │
# │  │  │  │  └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
# │  │  │  └────────── month (1 - 12)
# │  │  └─────────────── day of month (1 - 31)
# │  └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
Â
Synchronize copies of backups on different servers
Having backups only on the local disk cannot safeguard against the worst problems. In case that this disk or the server breaks it is like not having any backups at all. By default OpenBravo includes methods for syncing with Amazon S3 and locally mounted storage (pen drives, secondary disks, etc.)
Rather than use either of these methods, we have opted to configure rsync to replicate the /backup directory to a secondary server
Â
The essential command looks something like this:
rsync -avH --delete /backups/auto respaldo@
Â
This command is executed on bravo as user "root" and will sync everything in the /backups/auto directory and system configuration directories to foxtrot:/backups/bravo
To setup this operation automatically, it is necessary to exchange pairs to eliminate the need to input the respaldo user password every time.
respaldo@bravo$ ssh-keygen -t rsa
respaldo@bravo $ scp .ssh/id_rsa.pub root@foxtrot:.ssh/authorized_keys
Â
At this point, user root should be able to ssh (and rsync) to foxtrot without having to provide a password.
Finally, we can create a crontab entry for user respaldo on bravo to rsync automatically, every day at 9am (CET) the directories to foxtrot:
Â
0Â Â 9Â Â *Â Â *Â Â * Â rsync -avH --delete /backups/auto root@foxtrot:/backups/bravo
15Â Â 9Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/bravo
30Â Â 9Â Â *Â Â *Â Â * Â rsync -avH --delete /opt root@foxtrot:/backups/bravo
45Â Â 9Â Â *Â Â *Â Â * Â rsync -avH --delete /var/log root@foxtrot:/backups/bravo
Â
charlie
Â
05Â Â 10Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/charlie
15Â Â 10Â Â *Â Â *Â Â * Â rsync -avH --delete /opt root@foxtrot:/backups/charlie
25Â Â 10Â Â *Â Â *Â Â * Â rsync -avH --delete /var/atlassian root@foxtrot:/backups/charlie
35Â Â 10Â Â *Â Â *Â Â * Â rsync -avH --delete /var/log root@foxtrot:/backups/charlie
45Â Â 10Â Â *Â Â *Â Â * Â rsync -avH --delete /var/www root@foxtrot:/backups/charlie
Â
delta
Â
05Â Â 11Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/delta
15Â Â 11Â Â *Â Â *Â Â * Â rsync -avH --delete /opt root@foxtrot:/backups/delta
35Â Â 11Â Â *Â Â *Â Â * Â rsync -avH --delete /var/log root@foxtrot:/backups/delta
55Â Â 11Â Â *Â Â *Â Â * Â rsync -avH --delete /var/www root@foxtrot:/backups/delta
Â
echo
Â
05Â Â 12Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/echo
15Â Â 12Â Â *Â Â *Â Â * Â rsync -avH --delete /home root@foxtrot:/backups/echo
35Â Â 12Â Â *Â Â *Â Â * Â rsync -avH --delete /var/log root@foxtrot:/backups/echo
openvinopi
Â
05Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /etc root@foxtrot:/backups/openvinopi
10Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /home root@foxtrot:/backups/openvinopi
15Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /lib root@foxtrot:/backups/openvinopi
20Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /opt root@foxtrot:/backups/openvinopi
25Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /sbin root@foxtrot:/backups/openvinopi
30Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /snap root@foxtrot:/backups/openvinopi
35Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /usr root@foxtrot:/backups/openvinopi
40Â Â 13Â Â *Â Â *Â Â * Â rsync -avH --delete /var root@foxtrot:/backups/openvinopi