0

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 data

How 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 secondary

As per my requirement can we use below rsync on my server. will this work

rsync -avzhe ssh user@server.example.com:/var/www/ /var/www

I tested this on my local system. no luck

[ar@test ~]$ rsync -avzhe /home/ar/avi/ /home/ar/red/
sending incremental file list
drwxrwxr-x        4096 2016/03/03 07:28:13 .

sent 51 bytes received 12 bytes 126.00 bytes/sec total size is 0 speedup is 0.00

Solution

rsync -av --delete /home/ar/avi/ /home/ar/red/

AReddy
  • 3,172
  • 5
  • 36
  • 76

1 Answers1

0

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/

AReddy
  • 3,172
  • 5
  • 36
  • 76