找回密码
 立即注册

QQ登录

只需一步,快速开始

华强北商行 门户 前沿科技 查看主题

Linux系统下的数据镜像备份工具——Rsync

发布者: 小红帽 | 发布时间: 2013-12-16 21:13| 查看数: 3386| 评论数: 0|帖子模式

1、什么是rsync
rsync,remote synchronize顾名思意就知道它是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限、时间、软硬链接等附加信息。 rsync是用“rsync 算法”提供了一个客户机和远程文件服务器的文件同步的快速方法,而且可以通过ssh方式来传输文件,这样其保密性也非常好,另外它还是免费的软件。
  rsync 包括如下的一些特性:
  能更新整个目录和树和文件系统;
  有选择性的保持符号链链、硬链接、文件属于、权限、设备以及时间等;
  对于安装来说,无任何特殊权限要求;
  对于多个文件来说,内部流水线减少文件等待的延时;
  能用rsh、ssh 或直接端口做为传输入端口;
  支持匿名rsync 同步文件,是理想的镜像工具;
2、rsync的安装,通用方式:yum install rsync
3、rsync服务器的配置文件
cat /etc/rsyncd/rsync.conf # Distributed under the terms of the GNU General Public License v2# Minimal configuration file for rsync daemon# See rsync(1) and rsyncd.conf(5) man pages for help# This line is required by the /etc/init.d/rsyncd scriptpid file = /var/run/rsync.pidport = 873#address = 192.168.1.171#uid = nobody#gid = nobodyuid = rootgid = rootuse chroot = yesread only = no#limit access to private LANshosts allow=*#hosts deny=*max connections = 5motd file = /etc/rsyncd/rsync.motd#This will give you a separate log file#log file = /var/log/rsync.log#This will log every file transferred - up to 85,000+ per user, per sync#transfer logging = yeslog format = %t %a %m %f %bsyslog facility = local3timeout = 300[data]path = /data1list=yesignore errorsauth users = rootsecrets file = /etc/rsyncd/rsync.secretscomment = rsync data1 dir#exclude = beinan/ samba/[garbagekrc]path = /data1/garbagekrclist=yesignore errorsauth users = rootsecrets file = /etc/rsyncd/rsync.secretscomment = rsync garbagekrc dir
用户密码文件:
cat /etc/rsyncd/rsync.secrets root:test123
其中用户名必须是服务器上已经存在的用户
4、启动rsync服务:/usr/bin/rsync --daemon --config=/etc/rsyncd/rsync.conf
5、备份文件到服务器:
rsync -az --password-file=rsync.password jsoncpp/* root@IP::data/mydata/
其中:password-file可以指定密码。
6、rsync也可以从服务器上拉文件到本地。结合crontab可以实现定时同步的功能。
7、更多用法请:man rsync。

最新评论

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

 
 
加好友78950405
QQ臨時會話
華強北商行笔记本,手機
淘宝阿里旺旺
沟通交流群:
水货thinkpad笔记本
工作时间:
11:00-22:00
电话:
18938079527
微信联系我们
公告:
深圳市区免费送货服务重新上线

QQ| 华强北商行 ( 粤ICP备17062346号 )

JS of wanmeiff.com and vcpic.com Please keep this copyright information, respect of, thank you!JS of wanmeiff.com and vcpic.com Please keep this copyright information, respect of, thank you!

|网站地图 公司简介 联系方式 版权所有@

GMT+8, 2024-4-29 09:02 , Processed in 0.032823 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表