Linux文件远程实时同步-- Lsyncd
Posted dbamonkey
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux文件远程实时同步-- Lsyncd相关的知识,希望对你有一定的参考价值。
rsync服务端(wallet01) [root@wallet01 ~]# yum install -y xinetd [root@wallet01 ~]# yum install -y rsync [root@wallet01 ~]# vim /etc/xinetd.d/rsync # default: off # description: The rsync server is a good addition to an ftp server, as it # allows crc checksumming etc. service rsync { disable = no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } [root@wallet01 ~]# vim /etc/rsyncd.conf uid = root gid = root use chroot = no max connections = 1000 transfer logging = true log format = "%o %h [%a] %m (%u) %f %l" log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock secrets file = /etc/rsyncd.pwd fake super = yes [oracle] path = /home/oracle/backup auth users = oracle uid = oracle gid = oinstall read only = no [root@wallet01 ~]# vim /etc/rsyncd.pwd oracle:abcd.1234 [root@wallet01 ~]# chmod 600 /etc/rsyncd.pwd [root@wallet01 ~]# service xinetd start Starting xinetd: [ OK ]
rsync客户端(wallet02) [root@wallet02 ~]# yum install -y lua lua-devel [root@wallet02 ~]# yum install -y rsync [root@wallet02 ~]# yum install -y lsyncd [root@wallet02 ~]# vim /etc/lsyncd.conf settings { logfile ="/var/log/lsyncd/lsyncd.log", statusFile ="/var/log/lsyncd/lsyncd.status", inotifyMode = "CloseWrite", maxProcesses = 8, -- nodaemon =true, } sync { default.rsync, source = " /home/oracle/backup", target = "tomcat@192.168.1.201::oracle", delete = "false", -- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst", rsync = { binary = "/usr/bin/rsync", archive = true, compress = true, verbose = true, password_file = "/etc/rsyncd.pwd" _extra = {"--bwlimit=200"} } } [root@wallet02 ~]# vim /etc/rsyncd.pwd abcd.1234 [root@wallet02 ~]# chmod 600 /etc/rsyncd.pwd [root@wallet02 ~]# /etc/init.d/lsyncd start Starting lsyncd: [ OK ] [root@wallet02 ~]# /etc/init.d/lsyncd status lsyncd (pid 3282) is running...
以上是关于Linux文件远程实时同步-- Lsyncd的主要内容,如果未能解决你的问题,请参考以下文章