We have 2 Web Server node Primary and secondary, if the primary is down by any reason secondary will act as Prim. Now if we talk about the codes we which is on both the host. we should be synchronizing it with actual primary dataHow do we sync those codes?I understand that rsync can sync all the thing from the Live server to the secondary. but what about those changed which have deleted some file or folder, from live server rsync should remove those from the secondaryAs per my requirement can we use below rsync on my server. will this workrsync -avzhe ssh user@server.example.com:/var/www/ /var/wwwI tested this on my local system. no luck[ar@test ~]$ rsync -avzhe /home/ar/avi/ /home/ar/red/sending incremental file listdrwxrwxr-x        4096 2016/03/03 07:28:13 .sent 51 bytes  received 12 bytes  126.00 bytes/sectotal size is 0  speedup is 0.00Solutionrsync -av --delete /home/ar/avi/ /home/ar/red/
rsync complication on sync
linux;rsync;webserver
This command works for me, it gets sync with the live server and deletes the file which were deleted from the live server.rsync -av --delete /home/ar/avi/ /home/ar/red/