- 浏览: 304721 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
popotang:
关注raphael,从中学习一下
基于jquery, raphael的WEB流程设计器 -
Getwaysun:
拜读了,写得非常好
iframe跨域session丢失问题 -
chen4w:
good!
Geoserver & Openlayers 学习笔记 -
holysky:
Caused by: org.springframework. ...
Spring对属性文件加密解密应用 -
holysky:
希望能解决一下!
Spring对属性文件加密解密应用
我主要用rysnc同步文件,
rsync是一款非常优秀的文件同步管理软件,它也支持多种操作系统平台,在Unix环境中,rsync有着卓绝的功绩。希望这篇文档能对一些朋友有所帮助。
1. Install
[url]http://www.samba.org/rsync/[/url]
shell> tar zxvf rsync-x.x.x.tar.gz
shell> cd rsync-x.x.x
shell> ./configure && make && make install
目前大部分 Unix/Linux 默认即安装了 rsync。
2. /etc/rsyncd.conf
shell> touch /etc/rsyncd.conf
shell> vi /etc/rsyncd.conf
Edit /etc/rsyncd.conf as below:
uid = nobody
gid = nobody
use chroot = no
max connections = 5
pid file = /var/run/rsync.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log
[<dst-dir>]
path = <dst-dir-fullpath>
ignore errors
read only = no
list = yes
auth users = username
secrets file = /etc/rsyncd.secrets
3. /etc/rsync.secrets
shell> echo "jack:password" >> /etc/rsyncd.secrets
shell> chmod 600 /etc/rsyncd.secrets
*注:一定要把rsyncd.secrets的权限设为600,否则不能正常进行身份认证。
包括--password-file指向的密码文件,也必须设成600权限。
4. Autorun
>>> Idea 1 - only linux <<<
shell> vi /etc/xinetd.d/rsync
set DISABLE to yes, the result looks like this:
service rsync
{
disable = no <---------- change to yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
>>> Idea 2 - on openSUSE <<<
shell> echo "/usr/local/bin/rsync --daemon" >> /etc/init.d/boot.local
>>> Idea 3 <<<
shell> echo "/usr/local/bin/rsync --daemon" >> /etc/rc.local
5. Run daemon
shell> rsync --daemon
*注一:在rsync的man手册的 CONNECTING TO AN RSYNC SERVER 处有提到:
It is also possible to use rsync without a remote shell as the transport. In this case you will connect to a remote rsync server running on TCP port 873.
*注二:在rsync的man手册的 --port=PORT 选项解释中有提到:
This specifies an alternate TCP port number to use rather than the default port 873.
6. rsync 命令实例
6.1 显示目录内容
命令
------
a) rsync <dst-dir>
b) rsync -r <dst-dir>
c) rsync jack@192.168.0.1::<dst-dir>
d) rsync ssh_user@192.168.0.1:<dst-dir>
命令说明
---------
a) 显示<dst-dir>目录
内容
(第一层)
b) 递归显示<dst-dir>目录
内容
c) 显示远程主机<dst-dir>目录内容
*注1:端口模式, 基于rsync用户的身份验证
*注2:rsync server上的目录必须具有xx7的权限.
d) 查看
远程
主机<dst-dir>目录
内容
*注1:remote shell模式, 通过ssh连接的基于系统本地用户的身份验证
*注2:这里只使用了一个冒号(:),同时用户名是远
程主机
的ssh用户,密码也是ssh用户对应的密码。
*注3:使用"<dst-dir>",则列出<dst-dir>文件夹本身的信息。若要列出<dst-dir>文件夹内容,应使用"<dst-dir>/"。
参数说明
---------
-r 对目录进行递归操作
6.2 本地目录之间同步
命令
------
a) rsync -av --progress <src-dir>/ <dst-dir> *** 注意(/) ***
b) rsync -av --progress <src-dir> <dst-dir>
c) rsync -avu --progress --delete <src-dir>/ <dst-dir>
d)
rsync -av --progress --temp-dir=/tmp <src-dir>/ <dst-dir>
命令说明
---------
a) 同步src-dir目录下所有文件到dst-dir目录下
b) 同步src-dir目录下所有文件到dst-dir/src-dir目录下
c) 对src-dir目录内容向dst-dir目录下进行差异更新,有增加/更新则添加替换,有减少则对其删减
d) 比a)多了
--temp-dir=/tmp,即指定/tmp为临时交换区,这样可以避免因目标目录空间不够引起的无法同步文件的错误。
参数说明
---------
-a 相当于 -rlptgoD 的集合
-u 等同于 --update,在目标文件比源文件新的情况下不更新
-v 显示同步的文件
--progress 显示文件同步时的百分比进度、传输速率
--delete 删除目标目录中多于源目录的文件
6.3 异地主机之间同步
命令
------
a) rsync -avz --progress <src-dir> jack@192.168.0.1::<dst-dir>/
b) rsync -avz --progress <src-dir> jack@192.168.0.1::<dst-dir>/ --password-file=/home/jack/rsync.jack
c) rsync -avuz --progress --delete <src-dir> jack@192.168.0.1::<dst-dir>/ --password-file=/home/jack/rsync.jack
d) rsync -avz --progress jack@192.168.0.1::<dst-dir>/<src-dir> <dst-dir>
命令说明
---------
a) 同步本地<src-dir>目录的内容到远程主机192.168.0.1的<dst-dir>目录下,jack是rsync数据库用户(参见3. /etc/rsync.secrets)
b) 通过自动读取用户密码而实现非交互登录文件同步
c) 较b)多了-u和--delete
d) 同步远程主机内容到本地目录
参数说明
---------
-z 等同于 --compress,对传输的文件压缩,这对节约网络带宽或在网络资源紧张的情况下非常有用
--password-file 引用192.168.0.1上rsync用户jack口令的本地文件,创建方法如下
shell> echo "jackpwd" >> /home/jack/
rsync.jack
shell> chown jack:wheel
/home/jack/
rsync.jack
shell> chmod 600
/home/jack/
rsync.jack
发表评论
-
Linux远程文件拷贝
2012-12-04 10:54 790#!/bin/sh ############# ... -
Linux目录文件拷贝
2012-12-04 10:51 792#!/bin/sh mv /usr/local/ft ... -
Shell拷贝本地文件到远程主机
2011-08-02 16:07 1112#!/bin/sh timelimit=2 if [ $# ... -
Shell拷贝远程主机文件
2011-08-02 16:04 1440#!/bin/sh ################## ... -
RedHat中jdk的卸载、安装与配置
2011-06-17 09:24 4681最近要在服务器上配置JSP环境,看了一下jdk的版本只有1.4 ... -
linux命令集锦
2011-03-19 10:23 7961、linux字符编码设置 默认为UTF-8,如出现乱码可设 ... -
rsync 使用说明
2011-02-15 20:54 1034我主要用rysnc同步文件, rsync是一款非常优 ... -
虚拟机上安装了Linux怎么桌面不能全屏
2010-10-23 16:32 3714一、安装VMtools 点击VMware菜单的——虚 ... -
下载安装Cygwin
2010-10-18 09:50 687我们可以到Cygwin的官方网站下载Cygwin的安装程序,地 ... -
Linux必学的60个命令
2010-10-16 07:27 1036==========[[[ Linux必学的60个命令 ]]] ... -
rsync: mkstemp ... failed: Operation not permitted
2010-10-16 07:24 3112今天在整理文件时遇到 ... -
编译安装mysql+apache+php
2010-10-16 07:22 1017编译安装mysql+apache+php ========= ... -
通过 SSH 密钥验证实现在不同系统之间的脚本自动化
2010-06-15 09:08 1219SSH 简介 在日常工作 ... -
rsync工具简介
2010-06-14 07:31 1101rsync工具 简介 ... -
apache tomcat 配置笔记
2010-04-13 11:14 806hosts文件 是一个用于储 ... -
rsync 详解
2010-04-09 10:01 11151、什么是Rsync Rsync(remote sy ... -
linux-scp不输入密码
2010-04-02 13:22 2930以下是在机器Client的root ... -
详细解析Linux scp命令的应用
2010-04-02 13:21 1029Linux scp命令用于Linux之间复制文件和目录,具 ... -
rsync的配置
2010-04-02 13:12 940介绍 Rsync(remote sync)是类unix ... -
Linux 实用大全
2010-02-09 11:34 11111、Linux修改iptables,开放8080端口 ...
相关推荐
rsync服务搭建源码,包括启动脚本,使用说明文件,安装路径和其他。 如果需要搭建rsync环境的可以使用下载使用。谢谢!
Rsync详细讲解和说明,里面有每个参数的信息和讲解
演示如何在 cygwin 下安装 rsync-3.0.8,以及此工具的使用方法,以及如何使用。以及相关工具
Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options ...
平台前端tengine作为代理,后端两台IIS 7提供应用,为减少IIS的压力,使用两台IIS 7作为负载均衡,因此需要保证后端两台IIS 7的配置文件保持一致,在更新服务器时,在一台服务器上更新文件自动同步至另一台。
4 架设rsync服务器的示例说明 4.1 全局定义 4.2 模块定义 5 启动rsync 服务器及防火墙的设置; 5.1 启动rsync服务器; 5.2 rsync服务器和防火墙; 6 通过rsync客户端来同步数据; 6.1 列出rsync 服务器上的所提供的...
4 架设rsync服务器的示例说明 4.1 全局定义 4.2 模块定义 5 启动rsync 服务器及防火墙的设置; 5.1 启动rsync服务器; 5.2 rsync服务器和防火墙; 6 通过rsync客户端来同步数据; 6.1 列出rsync 服务器上的所提供的...
说明 利用cwrsync将 bat脚本,一键传输windows文件到linux,当然反过来也是可以的。 将压缩包解压到windows C盘根目录下即可。 请优先阅读“请阅读我.txt” 1、首先使用Pageant加载“putty key”文件夹中的1.ppk,这...
rsync+inotify说明.docx。
2.1.2也可以以本地模式来使用rsync,如果SRC和DST路径中都没有任何":"符号则表示该命令运行在本地模式,等同于cp命令。 rsync somehost.mydomain.com:: 这种模式则将会列出somehost.mydomain.com.可以访问的所有...
使用快速增量备份工具Remote Sync可以远程同步,支持本地复制,或者与其他SSH、rsync主机同步。特性它的特性如下:可以镜像保存整个目录树和文件系统。可以很容易做到保持原来文件的权限、时间、软硬链接等等. 本功能...
ssh免密码自动同步工具,包括使用说明、安装包、同步脚本,已经在实际项目上正常使用,无需动脑。
Linuxrsync配置具体实现说明.pdf
Linux_rsync_配置具体实现说明
#### 使用说明 第一步: 使用wget或者其他有效方式下载脚本: wget https://gitee.com/Xi_Tong/bash-script/releases/download/1.2/rs.sh 第二步: 使用bash命令启动脚本 bash rs.sh #如果不在当前目录请跟上目录的...
rsync同步数据,包含步骤说明
什么是断点续传? 在网络状况不好的情况下,对于文件的传输,我们希望能够支持可以每次传部分数据。断点续传其实正如字面...使用说明 文件断点下载 rsync -P --rsh=ssh root@192.168.0.11:/root/large.tar.gz /dou
rsync是一个功能非常强大的工具,其命令也有很多功能特色选项,我们下面就对它的选项一一进行分析说明。 rsync安装完毕后,我们可以通过rsync –help查看rysnc命令的使用。如下: Rsync的命令格式可以为以下六种: ...
同步方案:采用inotify监听文件变化,触发rsync实时同步,并且用supervisor监控inotify进程,莫明死掉后会立即重新启动。 需求:adminweb上的/data/www/user下的代码要同步到web1\2\3上 172.40.0.203:web1 172.40.0...
使用 rsync 的增量每日备份脚本 版权所有 (c)2015 版本 1.01 这个脚本绝对没有保证。 这是免费软件,欢迎您在某些条件下重新分发它。 有关详细信息,请参阅 CC BY-NC-SA 4.0。 用法: hactar [OPTIONS] SOURCE ...