rsync + inotify实时同步项目.doc

  1. 1、本文档共3页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多

rsync+inotify实时同步项目

同步脚本,对本地目录下所有内容处理。

在rsync服务器上(daemon上)配置:()

[root@localhost桌面]#/etc/init.d/sshdstatus

openssh-daemon(pid1970)正在运行..

[root@localhost桌面]#mkdir/share

[root@localhost桌面]#useradd-s/sbin/nologinrsync

[root@localhost桌面]#chown-Rrsync.rsync/share/

[root@localhost桌面]#ls-ld/share/

drwxr-xr-x.2rsyncrsync40965月2408:23/share/

[root@localhost桌面]#vim/etc/rsyncd.conf

uid=rsync

gid=rsync

maxconnections=200

timeout=300

pidfile=/var/run/rsyncd.pid

lockfile=/var/run/rsyncd.lock

logfile=/var/log/rsyncd.log

[share]

commentthisisstudenthomework

path=/share

readonly=no

authusers=shi

secretsfile=/etc/password.txt

list=false

hostsallow=/24

hostsdeny=/24

wq

[root@localhost桌面]#echoshi:789/etc/password.txt

[root@localhost桌面]#cat/etc/password.txt

shi:789

[root@localhost桌面]#chmod-R600/etc/password.txt

[root@localhost桌面]#ll/etc/password.txt

-rw-------.1rootroot85月2408:38/etc/password.txt

[root@localhost桌面]#rsync--daemon

[root@localhost桌面]#netstat-anptu|grep873

tcp00:873:*LISTEN26794/rsync

tcp00:::873:::*LISTEN26794/rsync

[root@localhost桌面]#ls/share/

空//客户端上传前为空

[root@localhost桌面]#ls/share/

test.txt//客户端上传后有内容

inotify的客户端:(05)//用同步脚本,在本地/backup目录写数据同步到服务器

[root@localhost桌面]#echo789/etc/pass.txt

[root@localhost桌面]#cat/etc/pass.txt

789

[root@localhost桌面]#chmod600/etc/pass.txt

[root@localhost桌面]#ll/etc/pass.txt

-rw-------.1rootroot45月2408:43/etc/pass.txt

[root@localhost桌面]#mkdir/test

[root@localhost桌面]#echotest/test/test.txt

[root@localhost桌面]#rsync-av/test/shi@::share--password-file=/etc/pass.txt//测试推送

sendingincrementalfilelist

./

test.txt

sent90bytesreceived30bytes240.00bytes/sec

totalsizeis5speedupis0.04

[root@lo

您可能关注的文档

文档评论(0)

shijianqiang + 关注
实名认证
内容提供者

高级 Linux 运维工程师持证人

工作以来一直奋斗在运维的前线,对整个运维流程有比较详细的了解、各类服务的部署维护、常用中间件、数据库、排查故障、监控报警、容器和k8s方面有较强的项目实战经验。

领域认证该用户于2024年03月29日上传了高级 Linux 运维工程师

1亿VIP精品文档

相关文档