rsyncを+ cronのファイル同期サービス

サーバーのインストールパッケージ:

rsync(centos7 )
rsync,rsync-daemon(centos8)

クライアント:
単純に(centos8の面で)rsyncの缶をインストール

サーバー側の設定

1.プロファイル
のvim /etc/rsyncd.conf

    uid = root
    gid = root
    use chroot = no
    #最大的链接数,0表示不去控制他
    max connections = 0
    ignore errors
    #备份时排除哪个文件夹
    exclude = lost+found/
    #日志
    log file = /var/log/rsyncd.log
    pid file = /var/run/rsyncd.pid
    lock file = /var/run/rsyncd.lock
    #是否做反向dns解析
    reverse lookup = no
    #允许哪个ip访问
    hosts allow = 192.168.8.0/24


    #可以多账号添加不同的文件夹[文件夹名]
    [backup] 
    #存放路径
    path = /backup/ 
    comment = backup
    read only = no
    #同步时用的虚拟账户
    auth users = rsyncuser
    #密码存放位置
    secrets file = /etc/rsync.p

2.サーバ側の準備ができて、ディレクトリで
ます。mkdir /バックアップ

ファイル生成ことを確認します。3.
エコー"rsyncuser:123"> /etc/rsync.pass
のchmod 600 /etc/rsync.pass

有効4.systemctl --now RSYNCD

クライアントの構成

1.検証ファイル作成
エコー"123"> /etc/rsync.pass
のchmod 600 /etc/rsync.pass

2.クライアントのテスト
のrsync -avz --delete --password-ファイル= /など/ rsync.pass /データrsyncuser @ IP ::バックアップ

フルバックアップを実現するために、上記の、自動バックアップを実現するために、定期的な仕事を書きますかinotifyでスクリプトを書きます。

タイミングタスク:
-e crontabの
#30の同期分
* / 30 * * * * / USR / binに/ rsyncの-avz --delete --password-ファイル=は/ etc / rsync.pass /データrsyncuser @ IP ::バックアップサーバー

おすすめ

転載: www.cnblogs.com/luck-pig/p/12115340.html