#StackBounty: #rsync #nfs #synchronization lsyncd – syncing multiple client to same directory breaks sync

Bounty: 50

Backgroud –

I’m trying to sync NAS with DR_NAS for HA purpose.
Unfortunately, there’s a complicated problem with this.

  1. NAS is on Alibaba cloud. They don’t support NAStoNAS sync yet.
  2. Best way I know is to install sync protocols between 2 NASs but I can’t directly connect to NAS. Alibaba controls it.
  3. I tried mounting them on a single system and use lsyncd/rsync between two NASs. But it failed.
  4. The lead author of lsyncd says that lsyncd uses Inotify Wait, which uses Linux Kernel to monitor filesystem. But Linux Kernel doesn’t watch NFS file system. It knows when the server itself writes file to NAS, but not when another system writes.
  5. So I must setup lsyncd on every systems that writes files to NAS because that’s the only way Inotify Wait knows.
  6. Sync was set. If a system writes file in (PROD NAS):/data/A/, lsyncd detects it and report it to rsync server. Rsync server then writes file in the corresponding directory (DR NAS):/data/A/

Current State –

enter image description here

It seemed to work pretty well until one day I found out that the sync was broken.

It looks like the writers can’t sync the same directory.

  • When SystemA is writing on /data/A and SystemB is writing on /data/B, rsync server does it too.
  • When SystemA and SystemB simultaneously write on /data/C, one of the sync breaks and only one system can write on /data/C from then.

Question

  1. Can multiple lsyncd clients sync with the rsync sever and use the same directory?
  2. Is there a better way to sync two remote NFS directories?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.