Top Nav

Content Sync For Load Balancer With Unison

This Unison program is great. It neatly handles syncing between two servers where changes are occurring on both sides. On one client site it takes about 30 seconds to compare/sync a 23GB /var/www/html/ structure with about 100 sites.

1) Install unison (http://www.cis.upenn.edu/~bcpierce/unison/). Requires “ocaml” compiler (http://caml.inria.fr/), and needs the “etags” command from emacs (so “yum install emacs”, whatever)

2) Set up a “/root/.unison/profile-name.prf” file. See example pasted below. Comment out “batch=true” and “silent=true” for initial test runs. Uncomment them for running from a cron job.

3) Run manually to test: unison profile-name

4) If you leave the logging turned on, make an /etc/logrotate.d/unison file, something like this:

5) Set up cron job(s). Create multiple profiles if specific paths need more frequent syncing. With silent=true, the jobs should produce no output (silent=true automatically sets batch=true).

Sample profile (/root/.unison/profile-name.prf)

Email
Print