我菜固我在

博客园 首页 新随笔 联系 订阅 管理

1.前题,有两台机器,A和B,要将A的东西同步到B中

2.同台机器请先安装rsync

3.请在B机器 vi /etc/rsyncd.conf 


pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[modle_name]
        uid = tomcat
        gid = tomcat
        path = 同步过来保存文件的目录
        comment = code of user_face
        read only = no
        strict modes = yes
        refuse options = delete
        auth users = user_name
        secrets file = /etc/rsyncd_auto_rsync_users
        hosts allow = A机器的IP
        hosts deny = *

 

3.在 B机器 vi /etc/rsyncd_auto_rsync_users

 内容如下:

user_name:密码

 

4.修改/etc/rsyncd_auto_rsync_users的权限

chmod 600 /etc/rsyncd_auto_rsync_users
 

5.启协rsync 

rsync --daemon 

 

6.在A机器内执行下面的语句:

sudo rsync -avrc  要同步的目录 user_name@B机器IP::modle_name/ 

回输,输入第三步的密码

 

7.控制台应会打印同步的流程,如果有问题,请到B机器的/var/log/rsyncd.log查看日志
 

 

 

posted on 2012-08-10 17:53  大侠(cer)  阅读(2143)  评论(0编辑  收藏  举报