Chinaunix首页 | 论坛 | 博客
  • 博客访问: 137301
  • 博文数量: 35
  • 博客积分: 2000
  • 博客等级: 大尉
  • 技术积分: 380
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-09 12:22
个人简介

http://www.76ku.cn

文章分类

全部博文(35)

文章存档

2011年(1)

2010年(17)

2007年(17)

我的朋友

分类: LINUX

2010-04-01 14:41:27

服务端配置:
(放主要数据的机器)
/etc/rsyncd/rsyncd.conf

---------------------------------------------
##### global settings

# 匿名用户设置
uid=nobody
gid=nobody
use chroot=no

# 最大连接数
max connections=4

pid file=/var/run/rsyncd.pid

# 日志
log format = %t %a %m %f %b
log file=/var/log/rsyncd.log

# 限制访问的 IP
hosts allow=192.168.1.0/255.255.255.0 10.0.0.1/255.0.0.0
hosts deny=*

#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes

# IP 超时时间
timeout=500




##### 设置模块:本机要同步的目录

[rsync-test]
path=/home/cdy/rsync-test
comment= This is rsync server

# 客户端只读
read only=yes

#
list=yes

# 排除目录
#exclude=nmap-5.00/ ssh/

# 忽略错误
ignore errors

# 用于用户验证
#auth users=cdy
#secrets file=/etc/rsyncd/rsyncd.secrets


-------------------------------------------------------

rsync --daemon --config=/etc/rsyncd/rsyncd.conf
(默认端口:873, 可以指定端口) --port=57777





客户端:
(备份数据机器)
---------------------

列出服务器上的同步资源
rsync --list-only 192.168.1.214::

执行命令(匿名方式)
crontab -e
*/1 * * * * /usr/bin/rsync -zqrtopg --delete 192.168.1.214::rsync-test /home/cdy/backup/

(如果不用默认端口,使用--port=57777)


部分参数:
rsync-test:服务器上定义的同步模块名称
-z 压缩传递
-r 递归
-q 安静模式
-topg 保留原文件的属性
--delete 如果服务端删除了文件,则客户端也删除
...

---------------------


==============
上传同步(把本地东东上传到服务器)
rsync -vzrtopg --progress ./get/  root@xxx.xxx.xxx.xxx::backup
================

阅读(432) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~