1. 程式人生 > >開源數據同步工具:Lsyncd部署實錄

開源數據同步工具:Lsyncd部署實錄

lsyncd

[root@king02 ~]# yum install -y xinetd [root@king02 ~]# yum install rsync [root@king02 ~]# vi /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@king02 ~]# vi /etc/rsyncd.conf 
uid = root
gid = root
use chroot = no
max connections = 10
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

[web]
path = /usr/local/tomcat7
auth users = tomcat
ignore errors = true
read only = no


[root@king02 ~]# vi /etc/rsyncd.pwd
tomcat:abcd.1234

[root@king02 ~]# chmod 600 /etc/rsyncd.pwd


[root@king02 ~]# service xinetd start
Starting xinetd:                                           [  OK  ]


[root@king01 ~]# yum -y install lua lua-devel
[root@king01 ~]# yum install rsync
[root@king01 ~]# yum install -y lsyncd

[root@king01 ~]# vi /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    = "/usr/local/tomcat7",
    target    = "[email protected]::web",
    -- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst",
    rsync     = {
        binary    = "/usr/bin/rsync",
        archive   = true,
        compress  = true,
        verbose   = true,
        password_file = "/etc/rsyncd.pwd"
        }
    }


[root@king01 ~]# vi /etc/rsyncd.pwd
abcd.1234

[root@king01 ~]# chmod 600 /etc/rsyncd.pwd


[root@king01 ~]# /etc/init.d/lsyncd start
Starting lsyncd:                                           [  OK  ]
[root@king01 ~]# /etc/init.d/lsyncd status
lsyncd (pid  3282) is running...


開源數據同步工具:Lsyncd部署實錄