加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_汕头站长网 (https://www.0754zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS 6.3下rsync服务器的安装与配置

发布时间:2016-09-15 07:29:19 所属栏目:Linux 来源:站长网
导读:一、rsync 简介 Rsync(remote synchronize)是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件,也 可以使用 Rsync 同步本地硬盘中的不同目录。

设置了”log file”参数时,在日志每行的开始会添加”%t [%p]“。

可以使用的日志格式定义符如下所示:

%a - 远程IP地址

%h - 远程主机名

%l - 文件长度字符数

%p - 该次 rsync 会话的 PID

%o - 操作类型:”send” 或 “recv”

%f - 文件名

%P - 模块路径

%m - 模块名

%t - 当前时间

%u - 认证的用户名(匿名时是 null)

%b - 实际传输的字节数

%c - 当发送文件时,记录该文件的校验码

五、rsync 服务器应用案例5.1. 在服务器端TS-DEV上配置rsync 服务a. 编辑配置文件# vi /etc/rsyncd/rsyncd.conf

5.1. 在服务器端TS-DEV上配置rsync 服务

a. 编辑配置文件

# vi /etc/rsyncd/rsyncd.conf

# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
    
# This line is required by the /etc/init.d/rsyncd script
# GLOBAL OPTIONS
uid = root                         
gid = root                                  
    
use chroot = no                             
    
read only = yes                            
    
#limit access to private LANs
hosts allow=172.16.0.0/255.255.0.0 192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0
hosts deny=*                                
max connections = 5                      
    
pid file = /var/run/rsyncd.pid             
    
secrets file = /etc/rsyncd/rsyncd.secrets   
#lock file = /var/run/rsync.lock           
    
motd file = /etc/rsyncd/rsyncd.motd        
    
#This will give you a separate log file
log file = /var/log/rsync.log               
    
#This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes                    
    
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
    
# MODULE OPTIONS
[davidhome]                               
path = /home/david/                       
list=yes                                   
ignore errors                              
auth users = david                          
comment = David home                  
exclude = important/ 
    
[chinatmp]
path = /tmp/china/
list=no
ignore errors
auth users = china
comment = tmp_china

b. 建立/etc/rsyncd/rsyncd.secrets文件

# vim /etc/rsyncd/rsyncd.secrets

david:asdf           #格式   用户名:口令 china:jk               #该用户不要求是系统用户

c. 为了密码的安全性,我们把权限设为600

# chown root:root /etc/rsyncd/rsyncd.secrets

# chmod 600 /etc/rsyncd/rsyncd.secrets

d. 建立连接到服务器的客户端看到的欢迎信息文件/etc/rsyncd/rsyncd.motd

# vim /etc/rsyncd/rsyncd.motd

(编辑:云计算网_汕头站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!