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

目录
相关文章
|
关系型数据库 MySQL 数据库
使用 StatefulSet 部署主从同步的 MySQL 集群
使用 StatefulSet 部署主从同步的 MySQL 集群
381 1
|
缓存
银河麒麟server-V10配置镜像源
银河麒麟server-V10配置镜像源
18584 1
|
网络协议 Android开发 数据安全/隐私保护
Android手机上使用Socks5全局代理-教程+软件
Android手机上使用Socks5全局代理-教程+软件
10945 2
|
6月前
|
存储 移动开发 Ubuntu
设置Ubuntu 22.04 LTS上的rsync同步服务
通过以上方法可以实现Ubuntu系统间基础且高效率得数据备份与共享。根据具体需求调整参数并测试以确认一切按预期工作。
363 14
|
网络协议 Linux 数据安全/隐私保护
如何在Windows本地快速搭建SFTP文件服务器,并通过端口映射实现公网远程访问
如何在Windows本地快速搭建SFTP文件服务器,并通过端口映射实现公网远程访问
10400 1
|
缓存 Linux
CentOS7配置阿里yum源 超详细!!!
CentOS7配置阿里yum源 超详细!!!
34484 2
|
缓存 Linux 开发工具
CentOS 7- 配置阿里镜像源
阿里镜像官方地址http://mirrors.aliyun.com/ 1、点击官方提供的相应系统的帮助 :2、查看不同版本的系统操作: 下载源1、安装wget yum install -y wget2、下载CentOS 7的repo文件wget -O /etc/yum.
267096 0
|
监控 Java 应用服务中间件
达梦数据库DEM监控部署教程分享
达梦数据库DEM监控部署教程分享
1126 2
|
存储 监控 网络安全
rsync 远程同步 基础介绍
rsync 远程同步 基础介绍
|
网络安全 开发工具
搭建麒麟桌面操作系统V10 SP1 2303
【7月更文挑战第15天】通过搭建麒麟桌面操作系统V10 SP1 2303的内网仓库,您不仅可以提高软件安装和更新的速度,还能增加网络的安全性。
1455 2

热门文章

最新文章