rysnc server端

  1、vim /etcrsyncd.conf (用户rsync,目录,模块,非系统虚拟用户及密码文件)

  2、创建共享目录 /data/www/{www,bbs,blog}

  3、创建rsync用户,并授权访问/data/www/

  4、创建密码文件,复制配置文件里的路径,然后添加密码内容:‘’虚拟用户名:密码‘’

  5、密码文件权限600 chmod 600 /etc/rsync.password

  6、rsync --daemon 启动rysnc进程,然后放入/etc/rc.local 开机自启

  7、tail /var/log/rsyncd.log 查看rsync运行log 

服务器端rsync重启服务

  1、 pkill rsync

  2、 kill `cat /var/run/rsyncd.pid`

  rsync --daemon

     查看是否是启动rsync服务

      ps -ef|grep rsync
      netstat -lnt |grep 873
      lsof -i:873

  

rsync client端

  1、密码文件和服务端没有任何关系。命令是--password-file=/etc/rsync.password

  2、密码文件内容:‘’密码‘’

  3、密码文件权限600 chmod 600 /etc/rsync.password

  

   

语法:

  pull:

rysnc -avz rsync_backup@10.0.0.11::www /data --password-file=/etc/rsync.password

  push

  rsync -avz /data/ rsync_backup@10.0.0.11::www --password-file=/etc/rsync.password

排错:

  1、防火墙和selinux

  2、/var/log/rsyncd.log

  3、整个部署流程整体考虑排查

  4、操作习惯当做一个大事。如rsyncd.conf的内容都复制一份,部署时直接复制粘贴使用;定位文件时尽可能使用tab补全;使用命令脚本时,先测试脚本本地单独运行没有问题,然后再复制粘贴到脚本中,尽量减少手打。

/etc/rsyncd.conf

##rsyncd.conf start##
uid = rsync
gid = rsync
use chroot = no
max connections =
timeout =
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 10.0.0.0/
hosts deny = 0.0.0.0/
auth users = rsync_backup
secrets file = /etc/rsync.password
## Module ##
[www]
comment = www added by jp at // :
path = /data/www/www/
## Module ##
[bbs]
comment = www added by jp at // :
path = /data/www/bbs/
#####################################
[blog]
comment = blog added by jp at // :
path = /data/www/blog/

排错

1、rsync: chgrp ".passwd.DKh65W" (in backup) failed: Operation not permitted (1)

[root@nfs01-31 tmp]# rsync -avz /etc/passwd rsync_backup@172.16.1.41::backup
Password:
sending incremental file list
passwd
rsync: chgrp ".passwd.DKh65W" (in backup) failed: Operation not
permitted (1)

sent 524 bytes received 125 bytes 432.67 bytes/sec
total size is 1,022 speedup is 1.57
rsync error: some files/attrs were not transferred (see previous errors) (code
23) at main.c(1178) [sender=3.1.2]

这个可能是配置文件里面没有加fake super = yes 在以前的版本里面不需要,现在版本需要

2、sending incremental file list
rsync: failed to write xattr user.rsync.%stat for "." (in server10): Permission denied (13)
rsync: failed to set times on "." (in server10): Operation not permitted (1)
原因:在rsync服务器端,rsync在模块的目标文件夹中没有权限

3、@ERROR: Unknown module 'sipbackup'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]

原因:

这个报错是因为hosts allow配置的有问题

检查了一下发现把192.168.40.0/24 写成了192.168.40.0\24

4、elastixbackup-20191215105901-ab.tar
     42,352,640 100%   17.16MB/s    0:00:02 (xfr#1, to-chk=0/1)
rsync: mkstemp "/NC/.elastixbackup-20191215105901-ab.tar.FcBWez" (in sipbackup) failed: Permission denied (13)

原因:服务器端的文件夹没有权限。

解决方法:drwxr-xr-x 2 rsync rsync 48 Dec 20 13:58 DMZ
drwxr-xr-x 2 root  root   6 Dec 19 15:47 NC
drwxr-xr-x 2 rsync rsync 48 Dec 18 00:16 ALG
drwxr-xr-x 2 rsync rsync 48 Dec 18 00:02 XA
drwxr-xr-x 2 rsync rsync 48 Dec 18 00:02 SZ
drwxr-xr-x 2 rsync rsync 48 Dec 18 00:02 SUZ
drwxr-xr-x 2 rsync rsync 48 Dec 18 00:00 SH
chmod -R rsync.rsync /NC

最新文章

  1. 基于Vue2.0的单页面开发方案
  2. 图片延迟加载(用jq自己写的方法)
  3. App Store 加急审核方式
  4. Graphs and Minimum Cuts(Karger's Min-Cut Algorithm)
  5. c++中自增(++)和自减(--)操作符
  6. http://qt-project.org/wiki/Category:Developing_with_Qt::QtWebKit#ff7c0fcd6a31e735a61c001f75426961
  7. java中有符号和无符号数据类型发生转换
  8. Ultra-QuickSort(树状数组求逆序对数)
  9. tomcat请求路由映射核心组件Mapper
  10. python笔记01-05
  11. Python:每日一题006
  12. Spring入门(1)
  13. Hadoop生态圈-Flume的组件之拦截器与选择器
  14. PHP5下WSDL,SOAP调用实现过程
  15. [转]Google 全球 IP 地址库
  16. 《C》数组
  17. Tornado/Python 学习笔记(二)
  18. Web前端面试指导(十二):::before 和:before有什么区别?
  19. 大专生自学web前端前前后后
  20. WebService authentication

热门文章

  1. 【Leetcode_easy】661. Image Smoother
  2. Docker - 在CentOS7中安装Docker
  3. iOS-objective-c产生随机数的方法
  4. Navicat安装及使用
  5. selenium3.0不兼容火狐的解决方案
  6. Python 解LeetCode:744. Find Smallest Letter Greater Than Target
  7. 正则表达式(Regular Expression, RegEx)学习入门
  8. C++经典类库
  9. C++:盾神与条状项链
  10. dg环境连接ORA-00604,ORA-16000: database open for read-only access