Backup Services
This section describes how the OpenVino servers are backed up using rsync:
Install rsync on all the servers:
[root@delta ~]# yum install rsyncalpha
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/alphabravo
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