rsync搭建

简介:

1.安装rsync和xinetd

yum install rsync xinetd


2.配置xinetd:

vi /etc/xinetd.d/rsync

#disable = yes修改为

disable = no


3.启动xinetd服务:

service xinetd start


4,编辑rsyncd.conf配置文件:

[root@dx-it-twebs01 wuxiaoyu]# cat /etc/rsyncd.conf 

#motd file = /etc/rsyncd.motd

use chroot = yes

uid=root

gid=root

max connections = 2000

timeout = 600

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsyncd.lock

log file = /var/log/rsync.log

ignore errors

read only = false

list = false

hosts allow = dx-it-tw03.dx.sankuai.com

hosts deny = *


[wikidata]

comment = wikidata

path = /data/store/

auth users = sankuai

secrets file = /etc/rsync/sankuai_rsyncd.secrets

[root@dx-it-twebs01 wuxiaoyu]# 


5,配置服务端秘钥

mkdir /etc/rsync

touch /etc/rsync/sankuai_rsyncd.secrets  ##密码为sankuai:123456789

chmod  600 /etc/rsync/sankuai_rsyncd.secrets


6,配置客户端服务秘钥

touch secrets.txt

chown  sankuai.sankuai secrets.txt

chmod  600 secrets.txt 


7,测试传输wuxiaoyu这个目录到rsync的服务端

rsync -varz  mfs/wuxiaoyu   sankuai@dx-it-twebs01.dx.sankuai.com::wikidata --password-file secrets.txt


网上有很多教程使用xinet.d来启动rsync服务端。

不过也使用rsync自带的来启动服务端

如:rsync --daemon --config=/home/leyewen/etc/rsync/rsyncd.conf

这种方式是以守护进程的方式启动服务,但是守护进程方式启动的进程不能被daemontools管理,daemontools 管理nginx的时候,nginx.conf 必须关闭daemon, daemon off;

http://kavy.iteye.com/blog/2119978

如果daemontools想管理rsync,则需要再run脚本中以如下方式启动(--no-detach 这个参数)

exec rsync --daemon  --no-detach --config=/etc/rsyncd.conf >> /var/log/rsync.log  2>&1

同时此脚本要有执行权限,chmod +x run

1
2
3
4
5
6
7
8
9
#!/bin/bash
NUM = `ps  - ef |grep  - v grep | grep  - "rsync --daemon" `
if  [ $NUM  - lt  1  ]
then
     cd  / opt / apps / rsync
     #ulimit -c unlimited
     exec  rsync  - - daemon   - - no - detach  - - config = / etc / rsyncd.conf >>  / var / log / rsync.log   2 >& 1
     #exec setuidgid sankuai /opt/apps/xxx_agent/xxx_agent > /dev/null 2>&1
fi

--no-detach 含义 

When running as a daemon, this option instructs rsync to not detach itself and become a background process. This option is required when running as a service on Cygwin, and may also be useful when rsync is supervised by a program such as daemontools or AIX's System Resource Controller--no-detach is also recommended when rsync is run under a debugger. This option has no effect if rsync is run from inetd or sshd.

原文:https://download.samba.org/pub/rsync/rsync.html


rsync 参数配置

http://tenderrain.blog.51cto.com/9202912/1874449

https://download.samba.org/pub/rsync/rsync.html




      本文转自Tenderrain 51CTO博客,原文链接:http://blog.51cto.com/tenderrain/1872677,如需转载请自行联系原作者


相关文章
|
11月前
|
缓存 Ubuntu 网络协议
ubuntu ifconfig命令找不到
通过上述指导,无论你是面临 `ifconfig`命令缺失的困惑,还是希望深入了解Ubuntu系统下的网络管理技巧,都能找到针对性的解决方案,进一步提升你的系统管理能力。
376 2
|
10月前
|
存储 分布式计算 固态存储
阿里云2核16G、4核32G、8核64G配置云服务器租用收费标准与活动价格参考
2核16G、8核64G、4核32G配置的云服务器处理器与内存比为1:8,这种配比的云服务器一般适用于数据分析与挖掘,Hadoop、Spark集群和数据库,缓存等内存密集型场景,因此,多为企业级用户选择。目前2核16G配置按量收费最低收费标准为0.54元/小时,按月租用标准收费标准为260.44元/1个月。4核32G配置的阿里云服务器按量收费标准最低为1.08元/小时,按月租用标准收费标准为520.88元/1个月。8核64G配置的阿里云服务器按量收费标准最低为2.17元/小时,按月租用标准收费标准为1041.77元/1个月。本文介绍这些配置的最新租用收费标准与活动价格情况,以供参考。
|
SQL 存储 监控
精通SQL:数据库查询与管理的全面指南
一、引言 在当今的数据驱动世界中,[数据库](https://www.iyxwzx.com/)技术无处不在,而SQL(结构化查询语言)则是数据库操作的基础
|
JSON JavaScript API
访问REST API:在Vue中消费和管理远程数据
【4月更文挑战第23天】本文探讨了在Vue应用中高效访问REST API的方法,包括选择合适的API、使用Axios或Fetch发送请求、封装API服务、处理响应和数据、错误管理及性能优化。关键点在于创建服务层封装请求,使用计算属性和方法处理数据,以及实施错误处理和性能提升策略。通过这些最佳实践,开发者能更好地管理和消费远程数据,构建出动态、响应式的Vue应用。
173 0
|
网络安全
rsync同步
rsync同步
idea右击项目却不显示svn提交按钮菜单Subversion选项,无法提交代码
idea右击项目却不显示svn提交按钮菜单Subversion选项,无法提交代码
2143 0
idea右击项目却不显示svn提交按钮菜单Subversion选项,无法提交代码
|
运维 关系型数据库 MySQL
【运维知识进阶篇】集群架构-Rsync服务详解
【运维知识进阶篇】集群架构-Rsync服务详解
688 0
win10开机USB鼠标要重新拔插才能用的解决方法
笔记本装成win10系统,用外接鼠标,装上了软件,打好了补丁,结果重启之后,发现外接鼠标不能用,要拔下来再插上去电脑才能识别,才能正常使用;
1642 0
|
监控 网络协议 网络安全
|
算法 Linux Shell
Linux:rsync文件同步
Linux:rsync文件同步
98 0