環境設定
- CentOS Linuxリリース7.5.1804(コア)
はファイアウォールを閉じ、selinux192.168.153.179
マスター
192.168.153.178バックアップ
展開を開始します
- マスターバックアップインストールrsyncサービス
yum -y install rsync
- マスター操作
vim /etc/rsyncd.conf
uid = root
gid = root
use chroot = yes
address = 192.168.153.179
port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = 192.168.153.0/24
[git]
path = /opt/git
comment = Document Root of www.51xit.top
read only =no
dont comperss = *.gz *.bz2 *.tgz *.zip *.rar *.z
auth users =root
secrets file = /etc/secrets.pass
ソースディレクトリを作成する
mkdir /opt/git
ファイルを任意に追加し、後でテストするときに使用します
[root@localhost git]# pwd
/opt/git
[root@localhost git]# touch a
[root@localhost git]# ls
a
承認されたアカウントとパスワード
vim /etc/secrets.pass
承認
chmod 600 /etc/secrets.pass
rsyncサービスを開始して表示します
rsync --daemon
ss -nltp|grep 873
LISTEN 0 5 192.168.153.179:873 *:*
- backup操作
サーバーによってバックアップされたデータディレクトリを格納するディレクトリを作成します
mkdir /opt/backgit
パスワードなしのログイン
vim /etc/secrets.backpass
承認
chmod 600 /etc/secrets.backpass
バックアップサーバーデータをテストする
rsync -az --password-file=/etc/secrets.backpass [email protected]::git /opt/backgit
バックアップが成功し、crontabタイミングタスクを追加
ls /opt/backgit/
a
スケジュールされたタスクを1分に1回、急いで操作します
[root@backup ~]# crontab -l
* * * * * rsync -az --password-file=/etc/secrets.backpass [email protected]::git /opt/backgit
- サーバー
削除ファイル作成ファイルxinzeng
pwd
/opt/git
rm -rf a
touch xinzeng
[root@server git]# ls
xinzeng
1分後のバックアップ側...
llコマンドを使用して時間を確認できます。これはあなた自身の選択
です〜_〜これで完了です。!!
[root@backup backgit]# ls
a
[root@backup backgit]# ls
a xinzeng
[root@backup backgit]# ll
总用量 0
-rw-r--r--. 1 root root 0 10月 29 13:47 a
-rw-r--r--. 1 root root 0 10月 29 14:13 xinzeng
終了しました〜_〜!!!