<div dir="ltr"><div>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.</div><div><br></div><div>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:</div><div><br></div><div><div><font face="monospace, monospace">csync2 30865/tcp # cluster synchronization tool</font></div><div><font face="monospace, monospace">csync2rev 30866/tcp # cluster synchronization tool</font></div></div><div><br></div><div>and a corresponding second entry to /etc/inetd.conf:</div><div><br></div><div><div><font face="monospace, monospace">csync2 stream tcp nowait root /usr/sbin/csync2 csync2 -i</font></div><div><font face="monospace, monospace">csync2rev stream tcp nowait root /usr/sbin/csync2 csync2 -xr</font></div></div><div><br></div><div>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.</div><div><br></div><div>On each host's boot, it runs a simple script:</div><div><br></div><div><font face="monospace, monospace">echo '' | nc -w 5 server1 30866; </font><span style="font-family:monospace,monospace">echo '' | nc -w 5 server2 30866; ...</span><br></div><div><br></div><div>This opens a socket to each of the other servers in the cluster and prompts them to synchronize their changes.</div><div><br></div><div>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.</div><div><br></div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><b><font color="#660000">Marcus Downing</font></b><div><a href="mailto:marcus@bang-on.net" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=marcus@bang-on.net&cc=&bcc=&su=&body=','_blank');return false;">marcus@bang-on.net</a></div><div><br></div></div></div></div>
</div>