`
奔跑的羚羊
  • 浏览: 570687 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

rsync服务

阅读更多
一.服务器端的配置
1.编辑/etc/rsyncd.conf文件,如果没有则新建一个
uid = nobody
gid = nobody
use chroot = no
read only = yes
timeout = 600
max connections = 40
hosts allow =192.168.1.0/24
secrets file = /etc/rsyncd.secrets
#motd file = /etc/rsyncd.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[rsync_grade]
path=/opt/vote/inc
comment=my rsync site


2.启动服务(如开有防火墙请允许873端口通过)
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf


3.停掉rsync
要 Kill rsync 进程,不要用 kill -HUP {PID} 的方式重启进程。
ps -ef|grep rsync|grep -v grep|awk '{print $2}'|xargs kill -9

也可以用
cat /var/run/rsyncd.pid | xargs kill -9



4.增加开机启动
在 /etc/rc.local 增加 /usr/bin/rsync --daemon --config=/etc/rsyncd.conf

5.客户端使用
1)客户端--->>服务端  (推) 客户端向服务器端推送文件 
--delete参数会删除服务器端中在客户端中没有的文件
/usr/bin/rsync -vrtup -R --delete /inc  root@192.168.1.10::rsync_grade


2)客户端--->>服务端  (取) 客户端到服务端取文件    
--delete参数会删除客户端中在服务器端中没有的文件
/usr/bin/rsync -vrtup -R  --delete root@192.168.1.10::rsync_grade /inc
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics