Backup com RSYNC PDF Imprimir E-mail

Backup em Servidores GNU/Linux por meio do RSYNC

Descrição:

rsync is a program that behaves in much the same way that rcp does, but has many more options and
uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is
being updated.

The rsync remote-update protocol allows rsync to transfer just the differences between two sets of
files across the network connection, using an efficient checksum-search algorithm described in the
technical report that accompanies this package.

Some of the additional features of rsync are:

- support for copying links, devices, owners, groups, and permissions

- exclude and exclude-from options similar to GNU tar

- a CVS exclude mode for ignoring the same files that CVS would ignore

- can use any transparent remote shell, including ssh or rsh

- does not require super-user privileges

- pipelining of file transfers to minimize latency costs

- support for anonymous or authenticated rsync daemons (ideal for mirroring)

Fonte: RSYNC MAN

 

Segue exemplo de um Bash Script simples, podendo ser aplicado em Servers Fedora/Red Hat/Cent OS:

#!/bin/bash
## Editado por Guto em 06.09.08
## Versao 1.2
dia=`date +%y"."%m"."%d\:%H"h"`
becape='OndeFicaraOBackup'
origem='MaquinaOrigemDosArquivos'

## Backup do Banco de dados por SSH (Chave criptografada)
ssh $origem mysqldump -u -p'SenhaBD' --opt -A -C -F | zip -q > $becape/mysql/allDatabases$origem_$dia.sql.zip
# MaquinaOrigem para MaquinaDestino
rsync -avuzP --progress --stats --delete -e 'ssh -p 22' /root/Backup/allDatabases$origem_$dia.sql.zip /mysql/ &&
# Apaga arquivos com mais de 30 dias
find $becape/mysql/ -type f -atime +30 -exec /bin/rm -rf {} ';'

## Backup FULL dos sites
# Backup do htdocs do Apache
rsync -avruzP --progress --stats --delete --exclude-from /diretorioDoScript/arquivos.txt/ $origem:/var/www/html $becape/ &&
# Aplicacoes hospedadas no Tomcat
rsync -avruzP --progress --stats --delete :/usr/local/tomcat/ $becape/



Obs: Exemplo do conteúdo do 'arquivos.txt':
'*.mp3'
'*.avi' 

Para tirar maiores dúvidas visite o forum do Projeto Fedora Brasil.