我想知道如何从一台服务器到另一台服务器进行简单备份。
我有 2 台服务器(一台用于网站,另一台是空的),我将通过 SSH 和 SFTP 在空服务器中创建的家庭帐户内的文件夹中创建 html 文件夹(apache 的 /var/www/html/)。
然后我会进行同步(我听说过 rsync 命令)。每天同步一次进行备份。
备份必须是一份,并且如果整个服务器由于任何问题而关闭,则同步不会在空服务器中删除。
有可能吗?
如何才能使这个过程安全又快速?
感谢整个 Ubuntu 社区!!!
答案1
Rsync is a fast and extraordinarily versatile file copying tool. It
can copy locally, to/from another host over any remote shell, or
to/from a remote rsync daemon. It offers a large number of options
that control every aspect of its behaviour and permit very flexible
specification of the set of files to be copied. It is famous for its
delta-transfer algorithm, which reduces the amount of data sent over
the network by sending only the differences between the source files
and the existing files in the destination. Rsync is widely used for
backups and mirroring and as an improved copy command for everyday use.
Rsync finds files that need to be transferred using a "quick check"
algorithm (by default) that looks for files that have changed in size
or in last-modified time. Any changes in the other preserved
attributes (as requested by options) are made on the destination file
directly when the quick check indicates that the file’s data does not
need to be updated.
来源:man rsync
拉和推两种方法均可用...