说明:

在CentOS7下部署rsync服务和在CentOS6上部署基本上是一样的,只是CentOS7自带了rsyncd启动脚本,由systemd管理而已。

rsync服务端配置
[root@SERVER1 ~]# rpm -qa|grep rsync
rsync-3.0.9-17.el7.x86_64
[root@SERVER1 ~]# uname -r
3.10.0-514.el7.x86_64
[root@SERVER1 ~]# systemctl stop firewalld
[root@SERVER1 ~]# grep -i "selinux=" /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
[root@SERVER1 ~]# rsync --version
rsync version 3.0.9 protocol version 30
[root@SERVER1 ~]# useradd -M -s /sbin/nologin rsync
[root@SERVER1 ~]# mkdir /data/test -p
[root@SERVER1 ~]# chown -R rsync.rsync /data/test
[root@SERVER1 ~]# vim /etc/rsyncd.conf
#rsync_configuration
##rsyncd.conf start## uid = rsync
gid = rsync
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[test]
path = /data/test
ignore errors
read only = false
list = false
hosts allow = *
hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password #rsync_config_______________end [root@SERVER1 ~]# echo 'rsync_backup:123456' >/etc/rsync.password
[root@SERVER1 ~]# chmod 600 /etc/rsync.password
[root@SERVER1 ~]# systemctl restart rsyncd
[root@SERVER1 ~]# ss -lntup|grep rsync
tcp LISTEN 0 5 *:873 *:* users:(("rsync",pid=7631,fd=4))
tcp LISTEN 0 5 :::873 :::* users:(("rsync",pid=7631,fd=5))

客户端配置

[root@opvnserver ~]# uname -r
3.10.0-862.el7.x86_64
[root@opvnserver ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@opvnserver ~]# systemctl stop firewalld
[root@opvnserver ~]# grep -i "selinux=" /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
[root@opvnserver ~]# rsync --version
rsync version 3.1.2 protocol version 31
[root@opvnserver ~]# echo '123456' >/etc/rsync.password
[root@opvnserver ~]# chmod 600 /etc/rsync.password

验证同步成功

[root@opvnserver ~]# ll /tmp/
总用量 8
drwx------ 2 oldboy oldboy 24 1月 25 19:31 ssh-i8u7DI17TF
drwx------ 2 oldboy oldboy 24 1月 24 17:33 ssh-Q7DZur3rIP
drwx------ 2 root root 6 1月 25 20:04 vmware-root
-rw------- 1 root root 8054 1月 24 17:35 yum_save_tx.2019-01-24.17-35.v9YeIo.yumtx [root@opvnserver ~]# rsync -avz /tmp/ rsync_backup@14.18.36.97::test --password-file=/etc/rsync.password [root@SERVER1 ~]# ll /data/test/
总用量 20
drwx------ 2 rsync rsync 4096 1月 25 19:31 ssh-i8u7DI17TF
drwx------ 2 rsync rsync 4096 1月 24 17:33 ssh-Q7DZur3rIP
drwx------ 2 rsync rsync 4096 1月 25 20:04 vmware-root
-rw------- 1 rsync rsync 8054 1月 24 17:35 yum_save_tx.2019-01-24.17-35.v9YeIo.yumtx

CentOS7中由systemd管理的rsyncd脚本内容

[root@SERVER1 ~]# cat /usr/lib/systemd/system/rsyncd.service
[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf [Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS" #<===此选项意思是rsync不将自己从终端上剥离 [Install]
WantedBy=multi-user.target

  

CentOS7下部署rsync服务的更多相关文章

  1. Linux下部署Samba服务环境的操作记录

    关于Linux和Windows系统之间的文件传输,很多人选择使用FTP,相对较安全,但是有时还是会出现一些问题,比如上传文件时,文件名莫名出现乱码,文件大小改变等问题.相比较来说,使用Samba作为文 ...

  2. 在 CentOS7 上部署 zookeeper 服务

    在 CentOS7 上部署 zookeeper 服务 1 用 SecureCRT 或 XShell 等 Linux 客户端工具连接至 CentOS7 服务器: 2 进入到 /usr/local/too ...

  3. CentOS7下安装SVN服务端

    CentOS7下安装SVN服务 1. yum命令即可方便的完成安装# sudo yum install subversion 测试安装是否成功:# svnserve --version 更改svn的默 ...

  4. Centos7下部署两套python版本并存

    Centos7下部署两套python版本并存   需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的 ...

  5. 基于CentOS7.5的 Rsync 服务详解

    第1章 Rsync概述 1.1 Rsync基本概述 rsync是一款开源的备份工具,可以在不同服务器(主机)之间进行同步备份, 可实现完全备份与增量备份,因此非常适合用于架构集中式备份或异地备份等应用 ...

  6. 在Linux环境下部署MySql服务

    之前有下载部署过几次,但是每次都会踩一些坑.特此记录在liunx下部署安装mysql的基本步骤: 1.卸载老版本的mysql find / -name mysql|xargs rm -rf     查 ...

  7. 用Xshell在centos7下安装lnmp服务

    虚拟机已创建好,本机已安装Xshell 一.准备工作:安装常用工具 1.1  yum install -y vim 备注:-y是同意安装过程中的询问,不被询问打断安装 vim:vim是一个类似于Vi的 ...

  8. centos7下部署elasticSearch集群

    OS:Centos7x虚拟机 1H2Gjdk:1.8elasticsearch:5.6.0 单节点配置请参考:centos7下elasticSearch安装配置 配置master节点 # 在配置文件的 ...

  9. Linux环境下部署svn服务详解

    说明 环境: 操作系统:centos 8.0 IP:39.100.228.13 安装 用ROOT账号登录,在控制台执行以下命令,一直默认安装就好可以了. [root@localhost ~]#yum ...

随机推荐

  1. Ubuntu18.04 一次性升级Python所有库

    pip是什么 pip 是 Python 包管理工具,该工具提供了对Python 包的查找.下载.安装.卸载的功能. 升级pip版本 默认Ubuntu自带的pip (pip 9.0.1)是基于Pytho ...

  2. @RequestParam,@PathVariable,@RequestBody

    @RequestParam 和 @PathVariable 注解是用于从request中接收请求的,两个都可以接收参数,关键点不同的是@RequestParam 是从request里面拿取值,而 @P ...

  3. P1559 运动员最佳匹配问题 by hyl 天梦

    #include<iostream> using namespace std; int n; int maxx[21][21]; int lie[21]; int aa[21]; int ...

  4. JS绘图

    https://www.highcharts.com.cn/demo/highcharts/ 百度的Echarts https://www.echartsjs.com/zh/index.html

  5. Elastcisearch.Nest 7.x 系列`伪`官方翻译:通过 NEST 来快捷试用 Elasticsearch

    本系列已经已经全部完成,完整版可见:https://blog.zhuliang.ltd/categories/Elasticsearch/ 本系列博文是"伪"官方文档翻译(更加本土 ...

  6. 【强化学习RL】model-free的prediction和control —— MC,TD(λ),SARSA,Q-learning等

    本系列强化学习内容来源自对David Silver课程的学习 课程链接http://www0.cs.ucl.ac.uk/staff/D.Silver/web/Teaching.html 本文介绍了在m ...

  7. 在eclipse中导入源码

    因为初学java有一个源码项目想要导入,在网上找了很多方法试了都不行,后来发现其实是想多了,这里说一个很简洁的方法.* 1.首先点eclipse中的File然后点import, 2. 然后选Gener ...

  8. 关于Hive中case when不准使用子查询的解决方法

    在公司用Hive实现个规则的时候,遇到了要查询某个字段是否在另一张表中,大概情况就是 A表: id value1 value2 1 100 0 2 101 1 3 102 1 B表: value1 1 ...

  9. set集合迭代

    1.迭代遍历 Set<String> set = new HashSet<String>(); Iterator<String> it = set.iterator ...

  10. c#数字图像处理(一)Bitmap类、 Bitmapdata类和 Graphics类

    Bitmap类. Bitmapdata类和 Graphics类是C#图像处理中最重要的3个类,如果要用C#进行图像处理,就一定要掌握它们. 1.1 Bitmap类Bitmap对象封装了GDI+中的一个 ...