Giter Club home page Giter Club logo

Comments (11)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
Multiple targets as a special case are no longer needed. Lsyncd 2 now handles 
multiple Syncs. Sources of syncs may be identical, or one even a subdir of 
another.

lsyncd -rsync /path/to/src host1::module -rsync /path/to/src host2::module

Don't worry about additional inotify ressources. It will only create one 
inotify watch per directory regardless in how many syncs the directory appears. 

It was splited so the targets do not interfer which each other. If host1 goes 
down, host2 will be synced regardless. Or a slow target does not slow down 
other targets.

Original comment by [email protected] on 14 Dec 2010 at 7:10

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
thank you for that! Now a semi-related question. What is best practice in your 
opinion when wanting to sync both directions? In other words does lsyncd watch 
both source and target if the target is local? Or do I need to create a second 
watch in the opposite direction i.e. lsyncd -rsync [source] [target] -rsync 
[target] [source] and have them both running at the same time? This is in 
regards to failover. Thanks

Original comment by [email protected] on 14 Dec 2010 at 7:46

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
If you do vice versa you need two syncs. But change the rsync options then! You 
need it to put the partial files in another place and better also only update 
when newer. This cannot be done in command line but requires a config file. 
Currently 2.0.0 rsyncOps can only be one String, so you cannot specify those, 
the best thing to do is to copy the "default_rsync" config out from lsyncd.lua 
paste it in your file and change the rsync options to something better fitting 
the two-way-sync case.

Current SVN and 2.0.1 will allow you to add several options as rsyncOps.

Original comment by [email protected] on 14 Dec 2010 at 7:52

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024

Original comment by [email protected] on 17 Dec 2010 at 2:03

  • Changed state: Done

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
Should the lua for syncing to multiple hosts look like:

sync{
        default.rsync,
        source="/var/www/wiki/",
        target="server1:/var/www/wiki/"
}

sync{
        default.rsync,
        source="/var/www/wiki/",
        target="server2:/var/www/wiki/"       
}


OR can two targets be specified in one sync? (NOTE: Specifying two targets in 
one sync does not result in any complaints from lsyncd)

sync{
        default.rsync,
        source="/var/www/wiki/",
        target="server1:/var/www/wiki/",
        target="server2:/var/www/wiki/"       
}

Regards,

Randy

Original comment by [email protected] on 18 May 2011 at 8:52

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
The former, Lsyncd doesnt see the second as conflict due to Lua syntax this 
actually being an array, the second definition overrides the first.

You can also do fancy stuff like following, since the config file is actually 
just a Lua script being interpreted:

targetlist = {
 "server1:/var/www/wiki/", 
 "server2:/var/www/wiki/"
}

for _, server in ipairs(targetlist) do
  sync{ default.rsync,
    source="/var/www/wiki/",
    target=server
  }
end

Kind regards, Axel

Original comment by [email protected] on 18 May 2011 at 9:46

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
Axel,
i upgraded lsyncd from 2.0.7 to 2.1.5 and trick

for _, server in ipairs(targetlist) do
  sync{ default.rsync,
    source="/var/www/wiki/",
    target=server
  }
end

doesn't work any more:

Error: error preparing /home/user/lsyncd.lua: Parameter "target" unknown. (if 
this is not a typo add it to checkgauge)

How can one sync multiple targets in lsyncd 2.1?

Thanks!

Original comment by [email protected] on 25 Sep 2013 at 8:27

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
Works for me, can you send me your complete config file?

Original comment by [email protected] on 25 Sep 2013 at 8:33

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
OK, problem was in using default.rsyncssh instead of default.rsync.

Original comment by [email protected] on 25 Sep 2013 at 10:30

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
This thread was very helpful for my exact situation, but I'm trying to add one 
more bit of complexity.  I'm attempting to launch a bash script that returns a 
list of valid hosts to sync to and put that into an array. I'm a lua newbie and 
would appreciate any help.  Here's the config:

hostlist=`/home/lsync/hostlist.sh`

hostarray = {}
for host in hostlist:gmatch("%w+") do table.insert(hostarray, host) end
for _, server in ipairs(hostarray) do
  sync {
        default.rsyncssh,
        source = "/test/",
        host = server,
        targetdir = "/test/",
}
end

Original comment by [email protected] on 8 Oct 2013 at 7:43

from lsyncd.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 26, 2024
can i use the below one ?
if no then how can i use this if I want to sync it through rsync module ?
sync {
    default.rsync,
    source="server::module/",
    target="/var/www/",
}

Original comment by [email protected] on 26 Feb 2014 at 1:47

from lsyncd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.