I’m trying to sync NAS with DR_NAS for HA purpose.
Unfortunately, there’s a complicated problem with this.
- NAS is on Alibaba cloud. They don’t support NAStoNAS sync yet.
- Best way I know is to install sync protocols between 2 NASs but I can’t directly connect to NAS. Alibaba controls it.
- I tried mounting them on a single system and use lsyncd/rsync between two NASs. But it failed.
- 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.
- So I must setup lsyncd on every systems that writes files to NAS because that’s the only way Inotify Wait knows.
- 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 –
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.
- Can multiple lsyncd clients sync with the rsync sever and use the same directory?
- Is there a better way to sync two remote NFS directories?