Setup disk mirroring between two servers using Unison is really simple, recently I have implemented disk mirroring between 2 Centos servers, below are steps which I followed and it is really working very nicely and it support two way communication.
1. Created ssh password login from server 1 to server 2.
2. Installed unison package on both the servers.
yum install unison
3. Created unison profile with .prf extension on server 1, it is mandatory that profile extension should have .prf extension, I was creating for root user so I created unison profile in root home directory,if you are using any other user then you have to create unison profile in particular user’s home directory.
root = /data/apps/html
root = ssh://root@app2//data/apps/html
save and quit
Here default is unison profile name and “/data/app/html” is mirroring directory
4. Then ran following command on server 1:-
when it finished without any issues then I added one cronjob for every minute.So that whatever file will get update in any of the servers at any point of time, it should reflect on other server also.
* * * * * /usr/bin/unison default