It's established that csync2 always synchronised as a push. The receiving
end runs csync2 -i (or -ii or -iii), and acts on the connection it
receives. There is currently no mechanism by which an instance can pull
changes. This works well when a local file has been changed and you wish to
update other hosts. It does not work as well when one member of a cluster
has been down, and on restarting it wishes to be fast-forwarded any changes
that happened while it was away.

On our own hosts we've implemented a makeshift solution: an addition to
inetd that allows one server to ask another to sync. We added a second
entry to /etc/services:

csync2          30865/tcp                       # cluster synchronization
csync2rev       30866/tcp                       # cluster synchronization

and a corresponding second entry to /etc/inetd.conf:

csync2          stream  tcp     nowait  root    /usr/sbin/csync2
 csync2 -i
csync2rev       stream  tcp     nowait  root    /usr/sbin/csync2
 csync2 -xr

When a connection is made on port 30866, this causes csync2 -xr to run on
that host, pushing its changes to all the running hosts it can see.

On each host's boot, it runs a simple script:

echo '' | nc -w 5 server1 30866; echo '' | nc -w 5 server2 30866; ...

This opens a socket to each of the other servers in the cluster and prompts
them to synchronize their changes.

I appreciate that as is this is far from tidy; but it points to a way
csync2 itself could implement this better. A flag `csync2 -o` (for
"others") could send a simple message to all other reachable servers in the
group in turn, requesting them to sync back to me please. This would of
course be guarded by the group's shared key, and if necessary it could be
guarded by a line in the config file as well.

*Marcus Downing*
Csync2 mailing list

Reply via email to