<a href="#%E7%9B%AE%E5%BD%95">目錄</a>
<a href="#remote-sync">Remote Sync</a>
<a href="#%E5%90%8C%E6%AD%A5%E7%9A%84%E7%B1%BB%E5%9E%8B">同步的類型</a>
<a href="#%E6%9C%AC%E5%9C%B0%E6%A8%A1%E5%BC%8F">本地模式</a>
<a href="#%E8%BF%9C%E7%A8%8B%E6%A8%A1%E5%BC%8F">遠端模式</a>
<a href="#rsync%E5%88%97%E8%A1%A8%E6%A8%A1%E5%BC%8F">RSync清單模式</a>
<a href="#rsync-%E6%9C%8D%E5%8A%A1%E6%A8%A1%E5%BC%8F">RSync 服務模式</a>
<a href="#setup-rsync-service">Setup RSync service</a>
<a href="#how-to-use-the-rsync-commands">How to use the rsync commands</a>
<a href="#inotifyrsync-real-time-sync">inotifyrsync Real-time sync</a>
<a href="#setup-inotify">Setup inotify</a>
功能:
1. 可以鏡像儲存整個目錄樹和檔案系統
2. 很容易做到保持原來檔案的權限,時間,屬主,軟硬連接配接等
3. 可使用rcp,ssh等方式來傳輸檔案,也可直接通過socket來進行連接配接
4. 支援匿名傳輸
General use for remote backup and backup localhost file into remote host(auto-periodical execute)
Distinction of backup and copy:
1. backup:Update the data.
2. copy:Move all data to other space.
RSync可以實作增量備份,而且可以同步更新資料,實時備份。RSync主機同步網絡YUM源,本地區域網路同步RSync主機YUM源。
将a目錄内的檔案通過rsync到另一個b目錄
example:
Attention:
a. /tmp/:不将tmp目錄備份,隻備份tmp目錄下的内容
b. /tmp:将tmp目錄及其以下的内容完全備份
底層是使用SSH協定
example:
Rsync同步源、SSH源 –> 備份檔案的源主機
step1. Create RSync service configuration file by manual
vim /etc/rsyncd.conf
step2. Create password file
step3. Start rsync service
rsync指令選項:
SSH Source create Key Pair:
RSync Source create Key Pair:
RSync backup:
inotify機制:監控檔案系統的變化
Software:inotofy-tools(安裝在RSyncServer)
inotify kernel parameter:
BUG:編譯安裝的過程中可能會出現執行以上指令後出現: libinotifytools.so.o:cannot open shared object file error
解決辦法:ln -S /usr/local/lib/libinotifytools.so.o /usr/lib64