# Real-time Bidirectional file sync solution?

## msalerno

Rsync - 1 way sync

Unison - Not real time, other than that, it's perfect.

tsyncd - Looks like it's dead and 1 way sync?

I have been searching all day for a good solution, but I cannot find one.  It's at the point where no matter what search terms I use in google, all I see are links that I have already visited.  I know I will get plenty of responses from people telling me to stop complaining and write my own, but I would like to see what is out there.  I'm sure I am not the only person looking for a solution like this.  I basically have a few servers in separate data centers across the US and I need to sync them all up.  A file could be added or altered on any of the servers at any time, so a solution like DRBD will not work either.

Does anyone have any solutions that don't involve dropping lots of $$$$$ for real time file replication?

Thanks

----------

## tberer

I asked myself a similiar question. Although I have not yet a satisfying answer you might want to have a look into OpenAFS. I have not tested it but I find it an interesting option. Especially for 'bigger' scenarios. See http://www.openafs.org/ for details. I also heared nice things about ZFS and iSCSI under OpenSolaris. But at the moment ZFS is still Beta under Linux according to http://www.wizy.org/wiki/ZFS_on_FUSE.

----------

## msalerno

I read up on that solution as well.

 *http://www.openafs.org/ wrote:*   

> "It offers a client-server architecture for federated file sharing and replicated read-only content distribution..."

 

BLAST!

----------

## nativemad

Hi, 

We had a little discussion about something like that, a while ago...

https://forums.gentoo.org/viewtopic-t-687929.html

my favourites are so far:

-drdb with ocfs2 (i still haven't tested it so far...)

-glusterfs with afr 

Cheers

----------

## msalerno

Anyone ever try MysqlFS?  MySQL Replication would solve lots of problems with syncing files.  Although I wonder what the sync would actually look like across the network.

I might have to setup a test case ....

Is there a way to sync svn repos?   If it's possible, you could consider using svn and mounting via webdav on each system.

For a web back-end, it wouldn't be the worst solution

----------

## nativemad

I'm always a bit sceptical against fuse.... isn't it just single-threaded?   :Rolling Eyes: 

----------

## msalerno

on the FUSE site it reads  *http://fuse.sourceforge.net/ wrote:*   

> By default FUSE filesystems run multi-threaded

 .

Although, it's still lots of layers to get to the FS.

----------

## daemonflower

I'm not sure if I understand your intent correctly, but I wonder why you don't just use plain old-fashioned NFS? If your concerns are about data security, just backup your NFS server. 

Why don't you describe in some more detail why you need bi-directional syncing? Because, if it's for collaboration, you could look into version management systems:

 *msalerno wrote:*   

> Is there a way to sync svn repos?   If it's possible, you could consider using svn and mounting via webdav on each system.

 

I personally use svn to sync my files on my desktop and my two laptops. As backup method I use a post-commit hook which rsyncs the repository to an offsite server after every commit. If all computers you want to sync are available over the internet you might also consider ssh'ing into them and calling "svn up" on each commit, but that's quite iffy, because usually your systems have private IPs behind a router. And usually it's not such a great idea to do an update automatically, because there might be conflicts. The usability of this approach depends on your situation.

----------

## nativemad

 *daemonflower wrote:*   

> I'm not sure if I understand your intent correctly, but I wonder why you don't just use plain old-fashioned NFS? If your concerns are about data security, just backup your NFS server. 
> 
> Why don't you describe in some more detail why you need bi-directional syncing? Because, if it's for collaboration, you could look into version management systems:
> 
>  *msalerno wrote:*   Is there a way to sync svn repos?   If it's possible, you could consider using svn and mounting via webdav on each system. 
> ...

 

Just as an example...

Imagine a web-company or something which is located in europe and in autralia, with a large userbase here and there. 

A Users profile might have some user-uploaded jpeg's for example... What would you do?

"svn up" from the upload-script?!?! NFS around the world?!?!

The same thing stands for replicated imap servers for example.

There you are... a secure, reliable, instantly syncing, auto-healing Filesystem would be very nice here!   :Wink: 

----------

## daemonflower

The keyword to google for here would be "hotfolders", I guess. When a file in a hotfolder is changed or added, some user-defined operation is executed. E.g. an rsync.

I worked with this once, but I don't have any idea how that was implemented, so I cannot give you any other details than the term that was used for it...  :Embarassed: 

----------

## nativemad

If its just a predefined folder. incron/rsync could do this quite well, but i wouldn't try a large deployment like that...  :Wink: 

Also file-locking is/can be a big show-stopper...

----------

## sf_alpha

If you want to raise conflict you need Version Control System anyway.

If you want just r/w (mirror) replication. GlusterFS + afr is good choice.

----------

## depontius

 *msalerno wrote:*   

> I read up on that solution as well.
> 
>  *http://www.openafs.org/ wrote:*   "It offers a client-server architecture for federated file sharing and replicated read-only content distribution..." 
> 
> BLAST!

 

I'm not sure what aspect is read-only, but that's not the only thing it does.  I'm sitting here at work with my $HOME in afs, and it's been there since we moved from mainframes to workstations back in the early 1990's.  You know, kind of like single-system-image.  Sit down at any workstation in the joint that has an open login prompt, login, and there you are, ready to go.

That said, the file permissions are not conventional Unix, and I understand that at the application level there can be some gotchas if you're not paying attention.  But at the user level, it's pretty much single-system-image.

----------

## msalerno

Just as an update ....  Glusterfs with replication was what I was looking for.

Thanks for the suggestions.

----------

## nativemad

Do you use it in production now? 

Do you have any throughput limits due to fuse?

--i just wonder as i had quite bad experiences on some older Servers (~quad 700) with hardened gentoo... 1. Fuse was so slow! 2. The Server-daemon crashed on heavy load even without afr!

I haven't looked into it deeper since then, but i'm still interested in it!   :Razz: 

----------

## cach0rr0

 *nativemad wrote:*   

> I'm always a bit sceptical against fuse.... isn't it just single-threaded?  

 

don't think so, but,  the benchmarks I've seen for ZFS under fuse have been less than impressive

e.g. http://www.csamuel.org/articles/emerging-filesystems-200709/#id2538255

----------

## depontius

 *msalerno wrote:*   

> Just as an update ....  Glusterfs with replication was what I was looking for.
> 
> Thanks for the suggestions.

 

Can you describe your situation and setup a little better?

I have (usually) 1 or 2 clients and a server.  Today the server runs nfsv4 on a RAID-1, and the clients mount that.  I think it would be really nifty to instead use local disk on the client, and have some sort of background replication keeping the server and the other client in sync.  I've looked a little at DRBD, but it seems that it and other replication schemes are server-oriented - in other words, a static system configuration where all mirrors are up, barring system crash.  I'd like this to be "soft", in that if one client is powered down, I still get mirroring between the other client and the server.  Then when the first client is powered up, the first thing it does is synchronize its mirror copy.

Obviously locking might be a little problem.  Then for fun, extend this to >2 clients.  But in all essence, I'm looking to the intermittent operation of the clients as being the main issue.

Does this fit in with your setup?

----------

## msalerno

I'm not at the office right now, but you can see my config here.

I have 2 fileservers that mount the gluster fs via fuse, both systems can write and read from the same location.  There is also a daemon that runs on each box.  I'll post a little more tomorrow when I get some time.  A client and server situation would probably even be easier than the config I have setup.

Also, the bug I mentioned in the thread in the link has been fixed.

----------

