美文网首页
Rsync环境配置

Rsync环境配置

作者: Jogging | 来源:发表于2016-10-19 11:05 被阅读40次

新拿到的服务器,想部署项目运行环境,同步已有服务器的第三方安装软件包,发现没有配置rsync服务,下面就动手在已有服务器上开启rsync服务,设置软件包目录。


场景:

172.16.25.2服务器可以从172.16.25.1服务器上同步/data/soft/目录下面的文件。

  • rsync配置
    在172.16.25.1服务器上创建rsync.conf文件
mkdir /etc/rsyncd
cd /etc/rsyncd
touch rsync.conf
vim rsync.conf

配置rsync.conf内容
motd file = /etc/rsyncd/rsyncd.motd
pid file = /var/run/rsyncd.pid
uid = root
gid = root
port = 873
address = 0.0.0.0
use chroot = yes
read only = yes
#write only=yes
hosts allow=172.16.25.0/255.255.255.0
secrets file = /etc/rsyncd/rsyncd.secrets
hosts deny=*
max connections = 5
log file = /var/log/rsync.log
timeout = 120

[soft]
path = /data/soft
list = yes
read only = yes
ignore errors
auth users = root

具体配置项的作用请参考官方文档。


  • 配置rsyncd.secrets文件
    上面的rsyncd.conf配置里面有一项secrets file = /etc/rsyncd/rsyncd.secrets 配置 ,指定同步文件时需要的密码,配置如下:
  touch /etc/rsyncd/rsyncd.secrets
  vim /etc/rsyncd/rsyncd.secrets
  配置内容
  root:root123

其中root是验证的用户,与rsyncd.conf文件中的用户一致,冒号后面是指定的访问密码,可以根据你的需要去设置不同的密码,这里设置密码为root123。

特别注意:
rsyncd.secrets文件的访问权限一定要设置成600,请执行chmod 600 rsyncd.secrets 命令。


  • 启动rsync服务
  /user/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf

  • 配置访问客户端

    登录到172.16.25.2服务器上。

mkdir /etc/rsyncd
cd /etc/rsyncd
touch rsyncd.passwd
vim rsyncd.passwd
配置密码:
root123

配置密码需要与rsync服务端的rsyncd.secrets文件中的密码相同。

特别注意: 修改rsyncd.passwd访问权限,执行chmod 600 rsyncd.passwd


  • 执行文件同步命令
rsync -arv --password-file=/etc/rsyncd/rsyncd.passwd root@172.16.25.1::soft ./

通过rsync 把172.16.25.1 路径别名为soft的文件同步到当前目录下面。

相关文章

  • 文件同步rsync

    安装环境 linux下的rsync服务端配置和window下rsync配置 1. linux的服务端配置如下: 安...

  • Rsync环境配置

    新拿到的服务器,想部署项目运行环境,同步已有服务器的第三方安装软件包,发现没有配置rsync服务,下面就动手在已有...

  • CetOS使用rsync

    环境 系统:CentOS 7 rsync服务端 安装# yum install rsync 编辑主配置文件# vi...

  • Rsync 服务器安装配置

    rsync安装 rsync服务端配置 启动配置 选择rsync服务器启动方式rsync服务器负载比较高,则使用独立...

  • linux文件同步

    配置rsync 同步数据 rpm包安装rsync及配置 [root@Hammer home]# rpm -qa |...

  • centos下安装rsync

    rsync安装 什么是rsync 首先,检查rsync是否安装,如果没有需要手动安装。 创建rsyncd服务的配置...

  • rsync数据同步备份

    测试环境: rsync-server:192.168.1.132 rsync-client:192.168.1.2...

  • Rsync备份服务

    服务端配置 1、安装rsync [root@backup ~]#yum install -y rsync 2、修改...

  • Mac Centos 通过 rsync 同步文件

    Mac 自带 rsync Centos 安装 rsync 配置文件vim /etc/rsyncd.conf 重启服...

  • Linux_279_rsync服务端配置文件解析

    rsync服务端配置选用rsync机器用作数据备份,也就是运行rsync服务端程序1、确保安装了rsync服务yu...

网友评论

      本文标题:Rsync环境配置

      本文链接:https://www.haomeiwen.com/subject/qgqxuttx.html