Comments (11)
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.
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.
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.
Original comment by [email protected]
on 17 Dec 2010 at 2:03
- Changed state: Done
from lsyncd.
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.
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.
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.
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.
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.
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.
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)
- lsyncd spinning 100% CPU, writing "Normal: waiting for 1 more child processes" indefinitely to the log HOT 5
- Why only -lts option as argument to rsync HOT 5
- rsyncOps in documentation should be rsyncOpts HOT 4
- lsyncd crashes when it gets a notification from kernel HOT 2
- maxDelays doesn't seem to work HOT 6
- initial sync is too agressive HOT 1
- Documentation HOT 6
- rsyncOpts should be able to override "--delete" too HOT 3
- Ubuntu installation ./configure finding lua HOT 1
- lsyncd on arm system not finding getConfig() HOT 2
- lsync dies after initial sync HOT 18
- Compilation Errors on Solaris 11 Express HOT 2
- lsyncd ignores "--filter" command in rsyncOpts for rsyncssh (and maybe rsync) HOT 3
- Thousands of log messages: "Normal: waiting for 1 more child processes." HOT 4
- User and Group ownership not preserved HOT 4
- Bi-directional sync (possibly with unison?) HOT 3
- ERROR: Connection to remote host failed. HOT 2
- Treat rsync exit code 13 as temporary problem HOT 1
- tried to implement the group permission example using octal notation instead of "g+rw", lsyncd status immediately becomes: lsyncd dead but pid file exists HOT 5
- Fails to make on FreeBSD 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsyncd.