rsync是類unix系統(tǒng)下的數(shù)據(jù)鏡像備份工具——remote sync。一款快速增量備份工具 Remote Sync,遠(yuǎn)程同步 支持本地復(fù)制,或者與其他SSH、rsync主機(jī)同步。
安裝rsync
- yum install rsync
配置:
rsync主要配置為3個(gè)文件
rsync.conf -- 主程序配置
rsyncd.motd -- 歡迎界面
rsyncd.secrets -- 賬戶密碼文件
rsync.conf
- vim /etc/rsyncd.conf
- 常規(guī)配置如下:
* pid file = /var/run/rsyncd.pid
* port = 873
* address = 127.0.0.1 **#填寫本地ip**
* uid = root
* gid = root
* use chroot = yes
* read only = yes **#是否只讀**
* hosts allow= *
* max connections = 5
* motd file = /etc/rsyncd.motd
* log format = %t %a %m %f %b
* syslog facility = local3
* timeout = 300
- 具體文件夾配置:
* [test] **#rsync目錄名**
* path = /data0/logs/test **#文件需要rsync的文件夾位置**
* list=yes
* ignore errors
* auth users = root
* secrets file = /etc/rsyncd/rsyncd.secrets **#密碼文件位置**
* comment = This directory use save XXX **#簡(jiǎn)介**
* exclude = a.log b.log **#排除指定文件不顯示**
rsyncd.motd
- vim /etc/rsyncd.motd
隨意設(shè)計(jì),用于向client展示
rsyncd.secrets
- mkdir /etc/rsyncd/
- vim /etc/rsyncd/rsyncd.secrets
- 輸入用戶名:密碼
例如root:abcd123
- chmod 700 /etc/rsyncd/rsyncd.secrets
啟動(dòng)
- rsync --daemon