{"id":98482,"date":"2024-06-24T06:48:10","date_gmt":"2024-06-23T22:48:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=98482"},"modified":"2024-06-24T06:48:10","modified_gmt":"2024-06-23T22:48:10","slug":"sersync-rsync","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/sersync-rsync.html","title":{"rendered":"\u89e6\u53d1\u5f0f\u6587\u4ef6\u540c\u6b65\u5728Sersync+Rsync\u4e2d\u5b9e\u73b0"},"content":{"rendered":"
\u80cc\u666f<\/strong><\/div>\n

\u901a\u5e38\u6211\u4eec\u5728\u670d\u52a1\u5668\u4e0a\u4f7f\u7528rsync\u52a0\u4e0acrontab\u6765\u5b9a\u65f6\u5730\u5b8c\u6210\u4e00\u4e9b\u540c\u6b65\u3001\u5907\u4efd\u6587\u4ef6\u7684\u4efb\u52a1\u3002\u968f\u7740\u4e1a\u52a1\u548c\u5e94\u7528\u9700\u6c42\u7684\u4e0d\u65ad\u6269\u5927\u3001\u5b9e\u65f6\u6027\u8981\u6c42\u8d8a\u6765\u8d8a\u9ad8\u3002\u4e00\u822crsync\u662f\u901a\u8fc7\u6821\u9a8c\u6240\u6709\u6587\u4ef6\u540e\uff0c\u8fdb\u884c\u5dee\u91cf\u540c\u6b65\uff0c\u5982\u679c\u6587\u4ef6\u91cf\u5341\u5206\u5e9e\u5927\uff0c\u90a3\u4e48rsync\u8fdb\u884c\u6821\u9a8c\u7684\u8fc7\u7a0b\u4e5f\u662f\u5341\u5206\u8017\u65f6\u7684\u3002\u800c\u4e14\u6b63\u5728\u53d1\u751f\u53d8\u5316\u7684\u5f80\u5f80\u662f\u5176\u4e2d\u5f88\u5c11\u7684\u4e00\u90e8\u5206\uff0c\u8fd9\u662f\u975e\u5e38\u4f4e\u6548\u7684\u65b9\u5f0f\u3002\u5176\u6b21\uff0crsync\u4e0d\u80fd\u5b9e\u65f6\u7684\u53bb\u76d1\u6d4b\u3001\u540c\u6b65\u6570\u636e\uff0c\u867d\u7136\u5b83\u53ef\u4ee5\u901a\u8fc7crontab\u65b9\u5f0f\u8fdb\u884c\u89e6 \u53d1\u540c\u6b65\uff0c\u4f46\u662f\u4e24\u6b21\u89e6\u53d1\u52a8\u4f5c\u4e00\u5b9a\u4f1a\u6709\u65f6\u95f4\u5dee\uff0c\u8fd9\u6837\u5c31\u5bfc\u81f4\u4e86\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u6570\u636e\u53ef\u80fd\u51fa\u73b0\u4e0d\u4e00\u81f4\uff0c\u65e0\u6cd5\u5728\u5e94\u7528\u6545\u969c\u65f6\u5b8c\u5168\u7684\u6062\u590d\u6570\u636e\u3002\u800cSersync+Rsync\u7684\u7ec4\u5408\u80fd\u591f\u8f83\u597d\u5730\u89e3\u51b3\u8fd9\u79cd\u95ee\u9898\u3002<\/p>\n

Sersync\u4ecb\u7ecd <\/strong><\/div>\n

sersync\u662f\u4f7f\u7528c++\u7f16\u5199\uff0c\u800c\u4e14\u5bf9linux\u7cfb\u7edf\u6587 \u4ef6\u7cfb\u7edf\u4ea7\u751f\u7684\u4e34\u65f6\u6587\u4ef6\u548c\u91cd\u590d\u7684\u6587\u4ef6\u64cd\u4f5c\u8fdb\u884c\u8fc7\u6ee4\uff08\u8be6\u7ec6\u89c1\u9644\u5f55\uff0c\u8fd9\u4e2a\u8fc7\u6ee4\u811a\u672c\u7a0b\u5e8f\u6ca1\u6709\u5b9e\u73b0\uff09\uff0c\u6240\u4ee5\u5728\u7ed3\u5408rsync\u540c\u6b65\u7684\u65f6\u5019\uff0c\u8282\u7701\u4e86\u8fd0\u884c\u65f6\u8017\u548c\u7f51\u7edc\u8d44\u6e90\u3002 \u56e0\u6b64\u66f4\u5feb\u3002
\n\u76f8\u6bd4\u8f83\u4e0a\u9762\u4e24\u4e2a\u9879\u76ee\uff0csersync\u914d\u7f6e\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u5176\u4e2dbin\u76ee\u5f55\u4e0b \u5df2\u7ecf\u6709\u57fa\u672c\u4e0a\u9759\u6001\u7f16\u8bd1\u76842\u8fdb\u5236\u6587\u4ef6\uff0c\u914d\u5408bin\u76ee\u5f55\u4e0b\u7684xml\u914d\u7f6e\u6587\u4ef6\u76f4\u63a5\u4f7f\u7528\u5373\u53ef\u3002
\n\u53e6\u5916\u672c\u9879\u76ee\u76f8\u6bd4\u8f83\u5176\u4ed6\u811a\u672c\u5f00\u6e90\u9879\u76ee\uff0c\u4f7f\u7528\u591a\u7ebf\u7a0b\u8fdb\u884c\u540c\u6b65\uff0c\u5c24\u5176\u5728\u540c\u6b65\u8f83\u5927\u6587\u4ef6\u65f6\uff0c\u80fd\u591f\u4fdd\u8bc1\u591a\u4e2a\u670d\u52a1\u5668\u5b9e\u65f6\u4fdd\u6301\u540c\u6b65\u72b6 \u6001\u3002
\n\u672c\u9879\u76ee\u6709\u51fa\u9519\u5904\u7406\u673a\u5236\uff0c\u901a\u8fc7\u5931\u8d25\u961f\u5217\u5bf9\u51fa\u9519\u7684\u6587\u4ef6\u91cd\u65b0\u540c\u6b65\uff0c\u5982\u679c\u4ecd\u65e7\u5931\u8d25\uff0c\u5219 \u6bcf10\u4e2a\u5c0f\u65f6\u5bf9\u540c\u6b65\u5931\u8d25\u7684\u6587\u4ef6\u91cd\u65b0\u540c\u6b65\u3002
\n\u672c\u9879\u76ee\u81ea\u5e26crontab\u529f\u80fd\uff0c\u53ea\u9700\u5728 xml\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f00\u542f\uff0c\u5373\u53ef\u6309\u60a8\u7684\u8981\u6c42\uff0c\u9694\u4e00\u6bb5\u65f6\u95f4\u6574\u4f53\u540c\u6b65\u4e00\u6b21\u3002\u65e0\u9700\u518d\u989d\u5916\u914d\u7f6ecrontab\u529f\u80fd\u3002
\n\u672c\u9879\u76eesocket\u4e0ehttp\u63d2\u4ef6\u6269\u5c55\uff0c\u6ee1\u8db3\u60a8\u4e8c\u6b21\u5f00\u53d1\u7684\u9700\u8981\u3002<\/p>\n

\u5b9e\u6218\u8fc7\u7a0b<\/strong><\/div>\n
\u4e00\u3001\u670d\u52a1\u5668\u73af\u5883
\n<\/strong><\/span><\/div>\n
\u670d\u52a1\u7aef\uff1a172.16.57.26 centos6.7 rsync-server  \u63a5\u6536\u6587\u4ef6\r\n\r\n\u5ba2\u6237\u7aef\uff1a172.16.57.25 centos6.7 sersync+rsync-client \u53d1\u9001\u6587\u4ef6<\/pre>\n
\u4e8c\u3001\u670d\u52a1\u7aef\u5b89\u88c5rsync-server<\/strong><\/span><\/div>\n

1.\u5b89\u88c5rsync<\/p>\n

rpm -qa | grep rsync #\u67e5\u770brsync\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\uff0c\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0cyum install\u76f4\u63a5\u5b89\u88c5\u5373\u53ef<\/pre>\n

2. \u4f7f\u7528xinetd\u65b9\u5f0f\u542f\u52a8rsync<\/p>\n

vim \/etc\/xinetd.d\/rsync #\u4fee\u6539disable = no\uff0cflags = IPv4<\/pre>\n

3. \u4fee\u6539rsync\u914d\u7f6e\u6587\u4ef6<\/p>\n

mkdir \/etc\/rsyncd\r\nvim \/etc\/rsyncd\/rsyncd.conf #\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5982\u4e0b\r\n# GLOBAL OPTIONS\r\nmotd file=\/etc\/motd\r\nport=873\r\npid file=\/var\/run\/rsyncd.pid\r\nlock file = \/var\/lock\/rsyncd\r\nlog file=\/var\/log\/rsyncd\r\ntransfer logging = yes\r\nlog format = [op]:%o [ip]:%a [module]:%m [path]:%P [file]:%f [size]:%l\r\nsyslog facility=daemon\r\nmax connections=100\r\n\r\n[recv]\r\ncomment = \"recv data from 57.25\"\r\npath = \/opt\/rsync_data\/recv #\u8fd9\u8fb9\u7684\u76ee\u5f55\u7684\u5bbf\u4e3b\u8981\u6539\u4e3aapprun\uff0c\u5728\u8fd9\u91cc\u540c\u6b65\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u7684\u662f\u666e\u901a\u8d26\u6237apprun\r\nlist = yes\r\nuse chroot = yes\r\nuid = apprun\r\ngid = apprun\r\nread only = no\r\nwrite only = no\r\nexclude =\r\ninclude =\r\nauth users = rsync\r\nsecrets file = \/etc\/rsyncd\/rsyncd.secrets\r\nstrict modes = yes\r\nhosts allow = 172.16.57.25\r\nhosts deny = *\r\n ln -s \/etc\/rsyncd\/rsyncd.conf \/etc\/rsyncd.conf  <\/pre>\n

4. \u5efa\u7acb\u7528\u6237\u8ba4\u8bc1\u6587\u4ef6<\/p>\n

vim \/etc\/rsyncd\/rsyncd.secrets\r\ntest:111111     #\u683c\u5f0f   \u7528\u6237\u540d:\u53e3\u4ee4\r\n\r\nchmod 600 \/etc\/rsyncd\/rsyncd.secrets #\u6743\u9650\u8bbe\u4e3a600\uff0c\u5426\u5219\u542f\u52a8\u4f1a\u62a5\u9519<\/pre>\n

5. \u542f\u52a8rsync<\/p>\n

\/etc\/init.d\/xinetd start\r\nnetstat -tpln | grep 873 #\u67e5\u770b873\u7aef\u53e3\u662f\u5426\u5df2\u7ecf\u5728\u76d1\u542c\u4e86<\/pre>\n
\u4e09\u3001\u5ba2\u6237\u7aef\u5b89\u88c5sersync+rsync-client
\n<\/strong><\/span><\/div>\n

1.\u5b89\u88c5rsync\uff0c\u548c\u670d\u52a1\u7aef\u4e00\u6837\uff0c\u6ca1\u6709\u5b89\u88c5\u7684\u8bddyum install\u5b89\u88c5<\/p>\n

2.\u5b89\u88c5sersync<\/p>\n

tar xzvf sersync2.5_64bit_binary_stable_final.tar.gz\r\nmv GNU-Linux-x86 \/opt\/programs\/sersync #\u89e3\u538b\u5e76\u62f7\u8d1d\u5230\u5b89\u88c5\u76ee\u5f55<\/pre>\n

3. \u670d\u52a1\u7aef\u5bc6\u7801\u8ba4\u8bc1\u3000\u3000\u3000\u3000\u3000<\/p>\n

vim \/etc\/rsync.pas #\u5728\u76f8\u5e94\u7684\u76ee\u5f55\u4e0b\u914d\u7f6e\u8eab\u4efd\u9a8c\u8bc1\u6587\u4ef6\uff0c\u91cc\u9762\u8f93\u5165\u670d\u52a1\u7aef\u7684\u5bc6\u7801\uff0c\u5e76chmod 600\r\nchmod 600 \/etc\/rsync.pas<\/pre>\n

4. \u542f\u52a8sersync<\/p>\n

.\/sersync2 -d -o confxml.xml<\/pre>\n
\u56db\u3001\u6d4b\u8bd5\u8ba4\u8bc1
\n<\/strong><\/span><\/div>\n

\u5728\u5ba2\u6237\u7aef\u4e0b\u76d1\u63a7\u76ee\u5f55\/opt\/rsync_data\/send\u4e0b\u6dfb\u52a0\u6587\u4ef6\u6216\u8005\u5220\u9664\uff0c\u670d\u52a1\u7aef\u7684\u63a5\u53d7\u76ee\u5f55\u90fd\u4f1a\u5b9e\u65f6\u5730\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n

\u5728\u6b64\u4f8b\u4e2d\uff0c\u670d\u52a1\u5668iptables\u548cselinux\u5747\u5904\u4e8e\u5173\u95ed\u72b6\u6001\u3002<\/p>\n

\u8fd9\u79cd\u65b9\u6cd5\u540c\u6b65\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u540c\u6b65\u6587\u4ef6\u7684\u6570\u91cf\u5982\u679c\u5f88\u591a\uff0c\u53ef\u80fd\u4f1a\u6709\u90e8\u5206\u6587\u4ef6\u5728\u540c\u6b65\u8fc7\u7a0b\u4e2d\u7f3a\u5931\u3002\u67e5\u9605\u76f8\u5173\u8d44\u6599\u540e\uff0c\u627e\u5230\u4e86\u5982\u4e0b\u7684\u89e3\u51b3\u65b9\u6848\u3002\u7531\u4e8e\u672c\u4f8b\u4e2d\uff0c\u4f7f\u7528\u7684\u662fxinetd\u65b9\u5f0f\u542f\u52a8\u7684rsync\u670d\u52a1\uff0c\u5728xinetd\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u4fee\u6539\u51e0\u4e2a\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

vim \/etc\/xinetd.conf\r\n\u4fee\u6539\u51e0\u4e2a\u53c2\u6570\uff1a\r\n cps             = 500 30\r\n instances       = UNLIMITED\r\n per_source      = UNLIMITED<\/pre>\n

\u5177\u4f53\u7684\u542b\u4e49\u53ef\u4ee5\u81ea\u5df1man xinetd.conf\u67e5\u770b\u4e00\u4e0b\u3002<\/p>\n

\u76ee\u524d\u8fd8\u6ca1\u6709\u540c\u6b65\u5927\u6587\u4ef6\u7684\u9700\u6c42\uff0c\u53ef\u80fd\u540c\u6b65\u5927\u6587\u4ef6\u5b58\u5728\u4e00\u4e9b\u5ef6\u8fdf\uff0c\u8fd8\u6709\u5f85\u89e3\u51b3\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/my.oschina.net\/Yumikio\/blog\/710846<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/sersync-rsync.html<\/a>\u7f16\u8f91\uff1a\u5411\u91d1\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u80cc\u666f \u901a\u5e38\u6211\u4eec\u5728\u670d\u52a1\u5668\u4e0a\u4f7f\u7528rsync\u52a0\u4e0acrontab\u6765\u5b9a\u65f6\u5730\u5b8c\u6210\u4e00\u4e9b\u540c\u6b65\u3001\u5907\u4efd\u6587\u4ef6\u7684\u4efb\u52a1\u3002\u968f\u7740\u4e1a\u52a1\u548c\u5e94\u7528\u9700 […]<\/p>\n","protected":false},"author":1482,"featured_media":98494,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-98482","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=98482"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98482\/revisions"}],"predecessor-version":[{"id":292062,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/98482\/revisions\/292062"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/98494"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=98482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=98482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=98482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}