處理 rsync、dd 和 snapshot 的多次調用

處理 rsync、dd 和 snapshot 的多次調用

伺服器經常運行以下操作。它拍攝邏輯磁碟區的快照,然後將內容備份到遠端備份伺服器。多個備份和傳輸可能同時發生。太多的 rsync 會話和已安裝的快照磁碟區會成為問題嗎?處理時如何優化伺服器效能?

lvcreate -L10G -s -n snapshot /home/folderA 

dd if=/mnt/snapshot bs=1M | (ssh [email protected] of=/tmp/backups bs=1M)

rsync -avzh --rsh "ssh -l username" /mnt/snapshot 192.168.1.5:/tmp/backups/  

答案1

對它們進行某種鎖定可能是最安全的,這樣無論選擇哪一個,一次僅運行一個實例,但如果不知道您(計劃)運行它們的頻率以及它們需要多長時間,就很難確定。

CentOS 有羊群(1)命令這將是有用的。

[“${FLOCKER}”! :

          This is useful boilerplate code for shell scripts.  Put it at
          the top of the shell script you want to lock and it'll
          automatically lock itself on the first run.  If the env var
          $FLOCKER is not set to the shell script that is being run,
          then execute flock and grab an exclusive non-blocking lock
          (using the script itself as the lock file) before re-execing
          itself with the right arguments.  It also sets the FLOCKER env
          var to the right value so it doesn't run again.

相關內容