Chinaunix首页 | 论坛 | 博客
  • 博客访问: 629609
  • 博文数量: 149
  • 博客积分: 3901
  • 博客等级: 中校
  • 技术积分: 1558
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-16 14:33
文章分类

全部博文(149)

文章存档

2014年(2)

2013年(10)

2012年(32)

2011年(21)

2010年(84)

分类:

2010-04-14 11:27:10



rsync配置
为实现同步更新文件配置了下rsync
在redhat系统上配置 rsync-2.6.3-1


服务端:
相关配置

1.在/etc/下创建三个文件
rsyncd.conf     rsyncd.motd     rsyncd.secrets


2.配置文件
vi rsyncd.conf
motd file = /etc/rsyncd.motd #欢迎文件
read only = no
list = yes
uid = root
gid = root
hosts allow = 192.168.128.133
hosts deny =192.168.128.0/24
max connections = 2
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
#define dirctory for rsync
[test]
comment = nagios's directory from 192.168.128.133
path =/test
secrets file =/etc/rsyncd.secrets#密码文件
auth users = test #rsync用户(与linux里的用户无关)
read only = no


3.欢迎文件
[root@localhost test]# vi /etc/rsyncd.motd
Welcome to use the rsync services!

4.密码文件
[root@localhost test]#vi /etc/rsyncd.secrets
test:test

5.chmod 600 /etc/rsyncd.*
6.运行rsync
rsync --daemon --config=/data/rsync/etc/rsyncd.conf
rsync的路径 rsync配置文件


7.客户端相关配置
a)安装rsync包
b)创建密码文件
[root@localhost ~]#vi /etc/rsyncd.secrets 
test#客户端只需密码无须用户
c)chmod 600 /etc/rsyncd.secrets
如果没有这步会报
password file must not be other-accessible
continuing without password file
Password:
d)rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.secrets test@192.168.128.130::test /root/test 
测试连接

8.实现定时同步
8.实现定时同步
crond.rsync
*/10 * * * * rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.secrets test@192.168.128.130::test /root/test
crontab crond.rsync
crontab -e编辑现在有crontab
crontab -l
阅读(879) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

liukaiyi2010-04-16 11:37:42

#!/bin/sh /data/rsync/bin/rsync -vzrtopguc --delete --password-file=/home/co_powerusercore/shell/rsyncd.scrt /home/co_powerusercore/tomcat/webapps/poweruser_core_rest_war --progress co_powerusercore@10.26.5.180::Powerusercore_180/tomcat/webapps/ /data/rsync/bin/rsync -vzrtopguc --delete --password-file=/home/co_powerusercore/shell/rsyncd.scrt /home/co_powerusercore/tomcat/webapps/poweruser_core_rest_war --progress co_powerusercore@10.26.5.181::Powerusercore_181/tomcat/webapps/