Today : Wed, 18 Sep 24 .


INFN-PADOVA wiki


Fabric Management

Notes

PmWiki

edit SideBar

Backup

Page: Site.Backup - Last Modified : Thu, 19 Jul 12

INFN-PADOVA backup settings (Bacula)

Backed up hosts

Bacula client installation and configuration

[Added bacula-client-3.0.2-1.i386.rpm to sl4-localrpms directory on gimo2]. [Added bacula-client-3.0.2-1.x86_64.rpm to sl5-localrpms directory on gimo2].

  • Install bacula-client on host to backup:
yum clean metadata
yum install -y bacula-client
  • Configure bacula-client - use the same password on all hosts (for epel repo)
cp /etc/bacula/bacula-fd.conf /etc/bacula/bacula-fd.conf.orig
cat > /etc/bacula/bacula-fd.conf
#
# Default  Bacula File Daemon Configuration file
#
#  For Bacula release 3.0.2 (18 July 2009) -- redhat 4.6
#
# There is not much to change here except perhaps the
# File daemon Name to
#

#
# List Directors who are permitted to contact this File daemon
#
Director {
  Name = "INFN-PD"
  Password = "eA77etjaJtoiFB++6U9vSzL/WFjZHAVk4FHOImt2cQ37"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = host.pd.infn.it-mon
  Password = "eA77etjaJtoiFB++6U9vSzL/WFjZHAVk4FHOImt2cQ37"
  Monitor = yes
}

#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = lxpd19.pd.infn.it-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/spool/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
}

# Send all messages except skipped files back to Director
Messages {
  Name = Standard
  director = "INFN-PD" = all, !skipped, !restored
}
[Ctrl-C]

For dag.repo the config file was (the WorkingDirectory has been changed):

#
# Default  Bacula File Daemon Configuration file
#
#  For Bacula release 3.0.2 (18 July 2009) -- redhat 4.6
#
# There is not much to change here except perhaps the
# File daemon Name to
#

#
# List Directors who are permitted to contact this File daemon
#
Director {
  Name = "INFN-PD"
  Password = "eA77etjaJtoiFB++6U9vSzL/WFjZHAVk4FHOImt2cQ37"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = host.pd.infn.it-mon
  Password = "eA77etjaJtoiFB++6U9vSzL/WFjZHAVk4FHOImt2cQ37"
  Monitor = yes
}

#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = lxpd19.pd.infn.it-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/lib/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
}

# Send all messages except skipped files back to Director
Messages {
  Name = Standard
  director = "INFN-PD" = all, !skipped, !restored
}
  • Start bacula-df daemon:
service bacula-fd start

Databases backup

If the machine hosts any (MySQL) databases you need to prepare a consistent and read-for-backup copy of them. This can be done with mysqlhotcopy utility (patched as in "Bug #27303" Newer version (1.23) seems to have fixed this bug). In this case ordinary backup of /var/lib/mysql directory has been disabled.

Create a /etc/cron.daily/mysqlhotcopy.cron daily cron job as follows (edit PASSWORD and DATABASES variables - keep mysql database backup):

# cat /etc/cron.daily/mysqlhotcopy.cron
#!/bin/sh
#
#  Mysqlhotcopy cron file
#       Create a backup copy of the selected mysql databases
#

USER=root
PASSWORD=********
DATABASES="mysql <db1> <db2> ..."
DIR=/db_bckp
LOG=/var/log/mysqlhotcopy.log
DEBUG=0   # set 1 to enable more verbose log

if [ ! -d ${DIR} ]; then mkdir -p ${DIR}; fi

if [ ${DEBUG} == 1 ]; then DEBUG="--debug"; else DEBUG=""; fi

echo -e "\n=== `date +"%Y-%m-%d %H:%M:%S"` - mysqlhotcopy cron START ===" >> ${LOG}
mysqlhotcopy --addtodest ${DEBUG} --user=${USER} --password=${PASSWORD} ${DATABASES} ${DIR} 2>&1 >> ${LOG}
echo -e "=== `date +"%Y-%m-%d %H:%M:%S"` - mysqlhotcopy cron END ===\n" >> ${LOG}

exit 0

After cron run you will find the consistent copy at /db_bckp directory (agreed with Backup Master - Alberto; do not change it).

NOTE: on MySQL 5.x (now only on prod-hlr-01) it is needed the following workaround (link) because mysqlhotcopy does currently not ignore log tables and apply_status for example:

[...]
DATABASES="mysql./~.+_log$/ <db1> <db2> ..."
[...]

Databases restore

To restore the backup from the mysqlhotcopy backup, simply copy the files from the backup directory to the /var/lib/mysql/{db-name} directory. Just to be on the safe-side, make sure to stop the mysql before you restore (copy) the files. After you copy the files to the /var/lib/mysql/{db-name} start the mysql again.


Powered by PmWiki
Skin by CarlosAB

looks borrowed from http://haran.freeshell.org/oswd/sinorca
More skins here