CentOS7下部署rsync服务

说明:

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

rsync服务端配置
[[email protected] ~]# rpm -qa|grep rsync
rsync-3.0.9-17.el7.x86_64
[[email protected] ~]# uname -r
3.10.0-514.el7.x86_64
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# grep -i "selinux=" /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
[[email protected] ~]# rsync --version
rsync version 3.0.9 protocol version 30
[[email protected] ~]# useradd -M -s /sbin/nologin rsync
[[email protected] ~]# mkdir /data/test -p
[[email protected] ~]# chown -R rsync.rsync /data/test
[[email protected] ~]# 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

[[email protected] ~]# echo ‘rsync_backup:123456‘ >/etc/rsync.password
[[email protected] ~]# chmod 600 /etc/rsync.password
[[email protected] ~]# systemctl restart rsyncd
[[email protected] ~]# 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))

客户端配置

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

验证同步成功

[[email protected] ~]# 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

[[email protected] ~]# rsync -avz /tmp/ [email protected]::test --password-file=/etc/rsync.password

[[email protected] ~]# 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脚本内容

[[email protected] ~]# 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

  

原文地址:https://www.cnblogs.com/blog-tim/p/10362817.html

时间: 2024-08-10 14:09:22

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

CentOS7 下部署NTP服务供内网客户机使用

1.安装NTP服务# yum -y install ntp 2.修改 ntp配置# vi /etc/ntp.conf # 记录和上级时间服务器的时间差异,默认配置,保留driftfile /var/lib/ntp/drift #表示nomodify客户端可以同步时间restrict default nomodify # 允许本机的一切操作,默认策略,保留restrict 127.0.0.1restrict ::1 # 阿里云NTP服务可修改本NTP服务时间restrict ntp.aliyun.

Centos7下部署Nginx

一.续Centos7下部署Node,Nginx安装部署: Nginx选择安装的是编译版(附下载地址:https://nginx.org/download/),根据自己的系统环境选择. 1.进入保存下载文件的路径,cd进入文件保存路径,命令: cd /usr/local/src 2.下载文件,我这选择最新版本nginx-1.13.11.命令: wget https://nginx.org/download/nginx-1.13.11.tar.gz 3.解压到特定文件夹下,进行解压,执行命令: ta

Linux 下部署 NFS 服务

Linux 下部署 NFS 服务 一般应用场景: 服务器端分配出共享的磁盘空间, 被一个或者多个客户端挂载,来实现数据共享,集中管理与维护和访问控制等. 步骤: 服务器端 - CentOS 7 安装必要的包: nfs-utils , rpcbindyum -y install nfs-utilsyum -y install rpcbind 配置 etc/exports 文件exports配置的参数选项比较多,具体细节用man去查看和了解.这里对主要4个参数做一个说明: all_squash :

一键部署rsync服务

#!/bin/bash #By Kaile QQ:10206334 #Blog http://kaile.blog.51cto.com RPCSTART=`/etc/init.d/rpcbind star #rsync软件是否安装 [ $(rpm -qa | grep rsync| wc -l) -eq 1 ]  || yum -y install rsync #rsync配置文件 [ -f /etc/rsyncd.conf  ] || touch /etc/rsyncd.conf #rsync

centos7下部署elasticSearch集群

OS:Centos7x虚拟机 1H2Gjdk:1.8elasticsearch:5.6.0 单节点配置请参考:centos7下elasticSearch安装配置 配置master节点 # 在配置文件的最后加上下面的配置 # 集群的名字 cluster.name: snsprj # 节点的名字 node.name: master # 是否是master节点 node.master: true 配置slave节点 # 新建文件夹es_slave mkdir es_slave # 解压并复制两份es_

Linux环境下部署svn服务详解

说明 环境: 操作系统:centos 8.0 IP:39.100.228.13 安装 用ROOT账号登录,在控制台执行以下命令,一直默认安装就好可以了. [[email protected] ~]#yum install svn 输入svnserve --version 查看安装信息 这里可以看到版本是1.10.2 配置 创建目录和版本库 [[email protected] ~]# mkdir -p /home/svn -p是递归创建多级目录 输入 svnadmin create /home/

centos7下部署nginx+supervisor+netcore2.1服务器环境

由于工作需要,自己部署了一台centos7服务器,用于部署netcore2.1的服务器环境,涉及到的相关内容主要有以下几点 netcore2.1版本的部署调试 supervisor守护进程的部署 nginx反向代理部署以及简单的负载均衡示例 其他用到的相关软件有vs2017,xshell,xftp 内容比较基础,适合刚刚接触的新手,高手就忽略吧 一.netcore2.1版本部署 首先需要一台服务器,当然用虚拟机也可以,我这里是自己买了一台阿里云服务器,最低配置的,价格便宜,用xshell远程链接

初探django-演示charade使用virtualenv来配置项目在centos7下部署

======================================= 2016/1/18 ####charade 是一个猜单词的小游戏. https://github.com/opera443399/charade prepare ------- 1. pip+virtualenv+django ::         [[email protected] ~]# yum install python-pip         [[email protected] ~]# pip inst

在 CentOS7 上部署 zookeeper 服务

1 用 SecureCRT 或 XShell 等 Linux 客户端工具连接至 CentOS7 服务器: 2 进入到 /usr/local/tools 目录中: cd /usr/local/ 如没有此目录则创建: mkdir -p tools 3 下载 zookeeper-3.4.8.tar.gz: wget http://apache.fayea.com/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz 4 返回到上一级目录并创建 zookeep