您在生产环境中为linux服务器使用哪些备份解决方案?您喜欢开源还是商业产品?
您认为备份软件中必不可少的功能是什么?
您不推荐哪些产品?备份软件的选择是否存在一些常见的陷阱?
您在生产环境中为linux服务器使用哪些备份解决方案?您喜欢开源还是商业产品?
您认为备份软件中必不可少的功能是什么?
您不推荐哪些产品?备份软件的选择是否存在一些常见的陷阱?
Answers:
就基本功能而言,您需要使用正确的工具来完成工作。
如果您的数据集很小并且适合单个卷,请使用rsnapshot或rdiff-backup。两者都提供增量备份,非常节省空间,并且非常易于使用。
对于具有脱机组件的更大或更复杂的备份,我使用Bacula,需要花费一些时间进行正确设置,但它坚如磐石并且具有许多功能。我建议将其与webacula之类的Web界面耦合。
顺便说一句,对于我拥有的每台服务器,我都使用rdiff-backup在/ var / backups /中保持/ etc的每日增量备份,它不花任何费用,并且如果您不知道,将为您省去很多麻烦为什么最后一次更改配置文件会造成如此大的破坏。
我使用rsync,既可以通过网络从我的Colo到我的家,也可以从我的家庭盒子到一个可移动的USB驱动器,然后我将其换成一个我可以一直放在办公桌上的USB驱动器。该脚本看起来像这样:
#!/bin/sh
STARTTIME=$(date +%s)
HOUR=$(date +%H)
DOW=$(date +%a)
WEEKNUM=$(($(date +%W|sed 's/^0\?//') % 4))
LOG=/tmp/last_hour.log
echo "" > $LOG
for DEST in /media/usb[0-9] ; do
if [ -d $DEST/allhats2 ] ; then
echo backing up to $DEST >> $LOG
YESTERDAY=`cat $DEST/yesterday`
LASTHOUR=`cat $DEST/last_hour`
PREV=$DEST/allhats2/hour$LASTHOUR
if [ ! -d $PREV ] ; then
echo could not find a directory at $PREV >> $LOG
PREV=$DEST/allhats2/$YESTERDAY
if [ ! -d $PREV ] ; then
echo could not find a directory at $PREV >> $LOG
PREV=$DEST/allhats2/Sat/
fi
fi
if [ $HOUR = "00" ] ; then
if [ $DOW = "Mon" ] ; then
echo moving last monday to week$WEEKNUM
rm -rf $DEST/allhats2/week$WEEKNUM
mv $DEST/allhats2/Mon $DEST/allhats2/week$WEEKNUM
fi
echo moving last midnight to $YESTERDAY
rm -rf $DEST/allhats2/$YESTERDAY
mv $DEST/allhats2/hour$HOUR $DEST/allhats2/$YESTERDAY
echo $DOW > $DEST/yesterday
fi
echo about to backup allhats2 to hour $HOUR >> $LOG
rm -rf $DEST/allhats2/hour$HOUR/
rsync -aSuvrx --delete / /boot /home /usr /var /backup_2/dbs --link-dest=$PREV/ $DEST/allhats2/hour$HOUR/ >> $LOG
echo $HOUR > $DEST/last_hour
fi
done
YESTERDAY=`cat /root/yesterday`
if [ $HOUR = "01" ] ; then
# Backup xen1
echo about to backup xen1 to /1u_backup/xen1/$DOW/
rm -rf /1u_backup/xen1/$DOW/
rsync -aSuvrx --delete -e ssh --exclude /var/spool/news/ root@xen1:/ --link-dest=/1u_backup/xen1/$YESTERDAY/ /1u_backup/xen1/$DOW/
for DEST in /media/usb[0-9] ; do
if [ -d $DEST/xen1 ] ; then
echo "backing up the backup"
rm -rf $DEST/xen1/$DOW/
rsync -aSuvrx --delete /1u_backup/xen1/$DOW/ --link-dest=$DEST/xen1/$YESTERDAY/ $DEST/xen1/$DOW/
fi
done
# Backup xen
echo about to backup xen to /1u_backup/xen/$DOW/
rm -rf /1u_backup/xen/$DOW/
rsync -aSuvrx --delete -e ssh root@xen:/ --link-dest=/1u_backup/xen/$YESTERDAY/ /1u_backup/xen/$DOW/
for DEST in /media/usb[0-9] ; do
if [ -d $DEST/xen ] ; then
echo "backing up the backup"
rm -rf $DEST/xen/$DOW/
rsync -aSuvrx --delete /1u_backup/xen/$DOW/ --link-dest=$DEST/xen/$YESTERDAY/ $DEST/xen/$DOW/
fi
done
echo done
echo $DOW > /root/yesterday
fi
rsync
。
我在Rackspace云文件存储中使用jungledisk。它只是每天晚上运行并执行其任务,我只是告诉它要备份什么,甚至还保留修订(某种)。异地,并且相当便宜。
BackupExec,带有免费的RALUS * NIX代理。易于导出,不需要SAMBA,并且可以与也由代理备份的Windows服务器配合使用。
我是backupninja包装程序bash脚本的用户,非常高兴。它可以在debian中作为标准存储库中的软件包提供。
根据数据类型,我直接使用Andrew Cholakian提到的rdiff-backup,或者先对LVM卷进行快照(由tinkertim提到),然后对其运行rdiff-backup。
rdiff-backup在不良的网络链接上无法非常有效地工作,在这种情况下,我在本地运行rdiff-backup,然后使用rsync将备份存储库与远程服务器同步。
您想备份到哪里?如果您想备份到另一台Linux服务器,rsync可以是使目录副本保持同步的宝贵工具。您可以通过采购以前的备份来保留基于时间的备份。从本质上讲,您每次都将获得完整备份,但它只会提取已更改的文件。这是一个使用rsync的bash脚本示例,请不要忘记阅读注释。
#!/bin/bash
# If you want to automate this script you will need to generate public/private
# key pairs for the user executing this script on the remote server.
# Change these variable to reflect where you want the backups to be stored
# and what servers will get backed up. Servers are seperated by spaces, do
# not use commas.
BACKUPLOCATION='/backups'
SERVERS=( testserver.example.com )
RSYNC='/usr/bin/rsync'
# These are variables used internally to the script DO NOT CHANGE!
TODAYSDATE=`date +%Y-%m-%d-%H`
FOLDERNAME='Backup-'$TODAYSDATE
CURRENTBACKUP='CurrentBackup'
USELINK=0
backup() {
# Test and make sure that the folder we are backing up to is writable
if [ -w $BACKUPLOCATION ]; then
# The folder we are backing up to is writable no problems
echo The backup destination is writable, continuing.
else
mkdir -p $BACKUPLOCATION
if [ $? -eq 0 ]; then
echo "Backup directory '$BACKUPLOCATION' was created"
else
# We can't write to the folder alert the user and stop the backup
echo The backup destination is not writable! Backup Failed!
exit 1
fi
fi
# If there are older backups then use them as a source directory
if [ -h "$BACKUPLOCATION/$CURRENTBACKUP" ]; then
echo
echo "Previous backup found... Will link to unchanged files..."
LASTBACKUP=`ls -l $BACKUPLOCATION | grep $CURRENTBACKUP | awk '{ print $11 }'`
echo $LASTBACKUP
echo "Deleting Old Link..."
rm -f $BACKUPLOCATION/$CURRENTBACKUP
USELINK=1
fi
for SERVER in ${SERVERS[@]}
do
echo
THISRUNLOC=$BACKUPLOCATION/$FOLDERNAME/$SERVER
mkdir -p $THISRUNLOC
if [ $USELINK -eq 1 ]; then
OPT="-a --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp --delete --link-dest=$LASTBACKUP/$SERVER $SERVER:/ $THISRUNLOC"
else
OPT="-a --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp $SERVER:/ $THISRUNLOC"
fi
#echo "Performing: rsync $OPT"
echo "Backing up server: $SERVER"
$RSYNC $OPT
if [ $? -eq 0 ]; then
echo "Success!"
else
echo "Backup failed with an error code of $?"
fi
echo
done
echo "Creating New Link..."
ln -s $BACKUPLOCATION/$FOLDERNAME $BACKUPLOCATION/$CURRENTBACKUP
echo "Backup Complete!"
}
restore() {
# I didn't write the restore code you can simply copy the files back
}
case $1 in
backup)
echo "Running the backup..."
backup
;;
restore)
echo "Restoring backup..."
restore
;;
*)
echo "Run this command with either backup or restore"
;;
esac