Rsync 服务端配置

简介: Rsync 服务端配置

配置 Rsync 服务器,模拟真实环境服务器数据同步。
A 是源服务器,B、C 为客户端服务器,因需求,B、C 服务器需
要从 A 某个同步某个目录到本地。
正式安装,官网下载 rsync 稳定版本,然后进行安装编译。
cd /usr/src ;wget
http://rsync.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz
tar xzf rsync-3.0.7.tar.gz && cd rsync-3.0.7 && ./configure --
prefix=/usr/local/rsync &&make &&make install
安装完毕,配置 rsync 配置文件,默认/etc/不存在 rsyncd.conf 配
置文件,需要手动创建,配置内容为如下:cat rsyncd.conf

###[global] 全局配置

uid = nobody
gid = nobodyuse chroot = no
max connections = 30
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[www]
read only = yes
path = /usr/local/webapps
comment = www
auth users =test
secrets file = /etc/rsync.pas
hosts allow = 192.168.0.11,192.168.0.12
[web]
read only = yes
path = /data/www/web
comment = webauth users =test
secrets file = /etc/rsync.pas
hosts allow = 192.168.1.11,192.168.0.0/24Rsync 配置参数说明:
[www] #要同步的模块名
path = /usr/local/webapps #要同步的目录
comment = www #这个名名称无所谓,最后模块名一直)
read only = no # no 客户端可上传文件,yes 只读
write only = no # no 客户端可下载文件,yes 不能下载
list = yes #是否提供资源列表
auth users =test #登陆系统使用的用户名,没有默认为匿名。
hosts allow = 192.168.0.10,192.168.0.20 #本模块允许通过的 IP
地址
hosts deny = 192.168.1.4 #禁止主机 IP
secrets file=/etc/rsync.pas #密码文件存放的位置
启动服务器端 RSYNC 主进程, /usr/local/rsync/bin/rsync
--daemon ,监听端口 TCP 873
设置 rsync 服务器端同步密钥:
vi /etc/rsync.pas
username:userpasswd (表示用户名:密码)test:test999
保存完毕,chmod 600 /etc/rsync.pas 设置权限为宿主用户读写。
最后在客户端配置同步密钥和命令,如下设置即可同步。
vi /etc/rsync.pas 输入服务器端配置的密码:
test999
保存即可开始同步:执行如下语句
Rsync -aP --delete test@192.168.0.100::www /usr/local/webapps
--password-file=/etc/rsync.pas
Rsync -aP --delete test@192.168.0.100::web /data/www/web
--password-file=/etc/rsync.pas
注*/usr/local/webapps 为客户端的目录,@前 test 是认证的用户名;
IP 后面 www 为 rsync 服务器端的模块名称。
Rsync 常用参数解析:
image.png
image.png

目录
相关文章
|
Linux Windows Ruby
puppet 服务端 客户端安装
转载:http://blog.51cto.com/ywzhou/1576141一、安装说明 官方安装向导https://docs.puppetlabs.com/guides/install_puppet/install_el.
1043 0
|
安全
Rsync远程同步配置
# rsync服务端配置 # 安装rsync软件包 yum -y install rsync # 生成rsyncd.
885 0
|
Linux
Linux rsync传输(服务端和客户端)
客户端: yum install -y rsync vi /etc/rsyncd.secrets username:password rsync -av yourfire --password-file=/etc/rsyncd.
1389 0
|
Linux 数据安全/隐私保护 开发工具
|
监控 关系型数据库 应用服务中间件
|
安全 Linux 数据安全/隐私保护
|
安全 Linux 网络安全
|
算法 Shell 数据安全/隐私保护
|
开发工具 数据安全/隐私保护 算法