安装

服务端

安装软件:

yum  -y  install  rsync

创建需同步的目录:

mkdir  -p  /data

编辑配置文件:vim /etc/rsyncd.conf

motd file = /etc/rsyncd.motd
transfer logging = yes
log file = /var/log/rsyncd.log #日志存放路径
port = 873  #端口号
address = 192.168.0.37  #IP地址
uid = root #使用的用户名
gid = root  #使用的密码
use chroot = no
read only = no
max connections = 10
[common]
comment = rsync lee
path = /data
ignore errors
auth users = simops
secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.0.0/255.255.255.0 #允许访问的地址段
hosts deny = *
list = falseUID = 0
GID = 0

创建用户密码:

echo  "simops:123456"  >  /etc/rsyncd.secrets
chmod  600  /etc/rsyncd.secrets

创建提示信息文件:

echo  "rsync simops"  >  /etc/rsyncd.motd

配置防火墙规则和关闭SElinux:

iptables  -I  INPUT  -p  tcp  --dport  873  -j  ACCEPT
setenforce 0 #临时关闭SElinux

启动服务:

rsync  --daemon
echo  "rsync  --daemon"  >>  /etc/rc.local

二、客户端(192.168.0.17):

安装软件:

yum  -y  install  rsync

创建需同步的目录:

mkdir  -p  /data

创建密码文件(免输入密码):

echo  "123456"  >  /root/passwd
chmod  600  /root/passwd

拉取:

rsync  -avz  --password-file=/root/passwd  simops@192.168.0.37::common  /data/

推送

rsync  -avz  --password-file=/root/passwd  /data  simops@192.168.0.37::common

遇到问题

1、执行推送命令之后报错

rsync  -avz  --password-file=/root/passwd  lee@192.168.0.37::common  /home/lee/rsync/
rsync  lee@ERROR: invalid uid root #使用的用户名
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]

解决方案在rsyncd.conf文件中添加下面两行即可解决问题

UID = 0
GID = 0 

2、服务器端同步目录没有权限

rsync  -avz  --password-file=/root/passwd  simops@192.168.0.37::common  /home/lee/rsync/
rsync  lee@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]

解决方案:服务器端同步目录没有权限,cwrsync默认用户是Svcwrsync。为同步目录添加用户Svcwrsync权限

3、没有关闭selinux

rsync  -avz  --password-file=/root/passwd simops@192.168.0.37::common  /data/
rsync  leereceiving incremental file list
rsync: opendir "." (in common) failed: Permission denied (13)sent 20 bytes  received 108 bytes  256.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1650) [generator=3.1.2]

这个问题看似已经同步可是去查看的时候没有同步过来
细细的检查了一下是selinux问题,关闭之后就可以了

centos7安装配置rsync以及遇到问题相关推荐

  1. Centos7 安装配置 tomcat 并设置自动启动

    Centos7 安装配置 tomcat 并设置自动启动 下载安装包 这里选择适合Linux的安装包,下载到本地后上传到centos服务器,或者直接通过wget命令下载 1 2 3 4 # cd /us ...

  2. vnc安装linux教程,Centos7安装配置vncserver详细教程

    CentOS7安装配置vncserver教程 一.安装VNC 首先要保证目标服务器安装有图形化环境,Linux系统下常见的桌面环境有GNOME和KDE,这里我们首先通过Group的方式安装GNOME桌 ...

  3. centos7安装配置vsftp搭建FTP

    参考文章: CentOS7下安装FTP服务 详解CentOS7安装配置vsftp搭建FTP centos7之vsftp安装和使用 1.安装vsftp # 查看是否已安装 方法一 [root@local ...

  4. Centos7 安装,配置静态IP

    Centos7 安装,配置静态IP 本文采用桥接方式 镜像地址 下载好镜像后使用vmware虚拟机进行安装即可(注意设置root密码). 安装完成后使用root登录,输入设置好的密码 设置静态ip v ...

  5. CentOS7 安装配置FTP服务器详解

    CentOS7 安装配置FTP服务器详解 1.FTP简介 ftp(File Transfer Protocol文件传输协议)是基于TCP/IP 协议的应用层协议,用于文件的传输,包括ftp服务器(或服 ...

  6. CentOS7 安装配置SFTP服务器详解

    CentOS7 安装配置SFTP服务器详解 1.SFTP简介 SSH文件传输协议(英语:SSH File Transfer Protocol,也称Secret File Transfer Protoc ...

  7. Centos7 下 配置 rsync 以及 rsync+inotify 实时同步

    Centos 7 下 配置 Rsync 以及 rsync+inotify 实时同步 rsync介绍 rsync是一个开源的快速备份工具,可以在不同主机之间镜像同步整个目录树,支 持增量备份,保持链接和 ...

  8. 开发人员学Linux(10):CentOS7安装配置代码质量管理平台SonarQube6.4

    2019独角兽企业重金招聘Python工程师标准>>> 1.前言 上一章讲述了如何配置使用源代码管理工具SVN并使之与Apache集成,从而实现代码的变更可追溯,虽然在大多数团队里强 ...

  9. centos7 安装配置mesos+marathon+zookeeper

    2019独角兽企业重金招聘Python工程师标准>>> 1,mesos介绍 Mesos诞生于UC Berkeley的一个研究项目,现已成为Apache Incubator中的项目.M ...

最新文章

  1. C#参考之方法参数关键字:params、ref及out
  2. stm32之通用定时器
  3. java如何禁用usb_IT技巧分享59: 如何禁用USB端口以及光驱来保证数据不被泄露
  4. redis-数据类型-string类型
  5. php-resque 轻量级队列
  6. python数字保留两位_Python 鲜为人知的数值格式化
  7. 炸了!我猜了7种颜色,就是没猜中苹果会出姨妈红!
  8. Ubuntu下安装Samba服务器
  9. linux的shell命令
  10. kiwi浏览器打开网页慢_kiwi浏览器
  11. hadoop权威指南-MapReduce气象程序实现过程
  12. UDA/语义分割/ICCV2021:Dual Path Learning for Domain Adaptation of Semantic Segmentation语义分割领域自适应的双路径学习
  13. vmware虚拟机共享文件夹设置(xp)
  14. iOS非常全的第三方库
  15. 摄氏度和开氏度的换算_摄氏度、华氏度和开氏度有何区别?
  16. rabbitmq新增用户
  17. matplotlib中绘图常用函数
  18. NP-Hard问题--世界七大数学难题之首
  19. 做个好领导:员工的善意,无价!
  20. storm和vgj vgj_DOTA2:VGJ改名J.Storm专注北美赛区,收编Forev新队进军Major

热门文章

  1. RecyclerView的使用和样式
  2. Android SDK目录结构介绍
  3. Android 动画(一)
  4. Kotlin学习笔记——安装配置kotlin
  5. php设计模式 -- 工厂模式
  6. Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明
  7. JSONObject和JSONArray的关系
  8. Velocity 页面加减运算
  9. flash、div、iframe的层级
  10. linux程序设计---序