rsync配置

rsync是由xinetd服务管理,需要安装xinetd

[root@x112 ~]# yum install -y xinetd

[root@x112 ~]# ps -ef| grep xin
root       1269   1157  0 10:02 pts/0    00:00:00 grep --color=auto xin
[root@x112 ~]# 
[root@x112 ~]# systemctl start xinetd
[root@x112 ~]# ps -ef| grep xin
root       1277      1  0 10:02 ?        00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
root       1279   1157  0 10:02 pts/0    00:00:00 grep --color=auto xin

[root@x112 ~]# netstat -antup | grep 873
[root@x112 ~]# netstat -antup | grep xin
[root@x112 ~]# 

[root@x112 ~]# rsync --daemon
[root@x112 ~]# netstat -antup | grep 873
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      1290/rsync         
tcp6       0      0 :::873                  :::*                    LISTEN      1290/rsync         
[root@x112 ~]# vim /etc/rsyncd.conf
[root@x112 ~]# rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:

 rsync使用系统账号传送文件

[root@x112 ~]# rsync -avz --delete /var/www/html  get1@192.168.0.170:/web1

 

rsync使用非系统账号传送文件:,需要编辑/etc/rsyncd.conf文件

/etc/rsyncd.conf文件,在启动rsync --daemon后就会自动生成。

使用rsync借助ssh无口令登陆远程备份到rsync服务器指定目录

[root@x111 software]# ssh-keygen -t rsa
[root@x111 software]# ssh-copy-id  -i .ssh/id_rsa.pub 192.168.0.112
[root@x112 software]# rsync -e ssh -avz nginx-1.14.2 192.168.0.101:/home/webserver
[root@x112 software]# rsync -e ssh -avz Discuz_7.2_FULL_SC_UTF8.zip root@192.168.0.101:/home/webserver

  

  

  

原文地址:https://www.cnblogs.com/xiaofeng666/p/13353814.html