CentOS 5.5下安装rsync笔记

1.安装rsync,一路yes。
[root@slave2 ~]# yum install rsync

2.修改rsync服务端配置文件,服务端为disable =yes,客户端disable = no,其他不动。
[root@master bin]# cat /etc/xinetd.d/rsync 
service rsync
{
        disable = yes  
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}


3.建立rsync.conf,集群下其他client同样配置
[root@master bin]# vi /etc/rsync.conf 
添加如下内容:
uid = nobody
gid = nobody
user chroot = no
max connections = 200
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[hadoop]             #定义要同步的模块
path=/opt/chd4.5/    #定义要同步备份的目录
ignore errors
read only = no
list = no
hosts allow = 192.168.21.0/255.255.255.0
auth users = test
secrets file = /etc/rsyncd.password

3.服务端添加 添加用户:密码.
[root@master bin]# vi /etc/rsyncd.password
root:123

4.客户端添加 添加密码. 
[root@master bin]# vi /etc/rsyncd.password
123         #密码要和Rsync Server密码一样

5启动rsync server
  启动rsync服务端(独立启动)
[root@master bin]# /usr/bin/rsync --daemon

  启动rsync服务端 (有xinetd超级进程启动)
[root@master bin]# /etc/init.d/xinetd reload

5.从服务器上下载文件
[root@slave1 bin]# rsync -avz --password-file=/etc/rsyncd.password root@192.168.195.128::hadoop /opt/chd4.5/

[root@slave1 bin]# rsync -avz --password-file=/etc/rsyncd.password root@192.168.195.128::hadoop /opt/chd4.5/
  从本地上传到服务器上去
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.password /opt/chd4.5/ root@192.168.195.128::hadoop

6.可以把需要备份同步的文件放入定时任务中,自动备份同步。


安装过程遇到一些错误,可以参考如下文章解决:
http://blog.csdn.net/jackdai/article/details/460460
http://www.nginx.cn/tag/rsync
http://blog.csdn.net/csj50/article/details/6742561
http://www.jb51.net/article/31920.htm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值