How to get master-master replication with Subversi

2020-02-23 08:36发布

问题:

Seems like a simple problem:

  • I have an SVN repo inside our firewall.
  • I have an SVN repo outside our firewall.
  • I have users inside, and outside, the firewall. (no VPN isn't an option :( that'd be too easy)
  • machines inside the firewall CAN talk to the outside SVN server. But not the other way.
  • the outside SVN is a temporary thing - the main repo will always be inside.

I want to somehow (from inside, most likely) take all the changes in one, and apply them to the other. And vice versa. Sounds simple, and I assume that the likes GIT can do this, but we are using SVN.

Anyone done this? I don't mind it being a manual process - there are only a couple of external people, and they don't need updates to-the-minute, two or three times a day would do.

I believe apache.org does this, but I can't find docs on HOW they do this. There are a couple of products out there which do it (well, one), but I'd love to know if anyone has a nice, clean way to do it without them. svnsync does this, just only in one direction (master-slave)

Happy to have it run on windows, Linux or Mac, as we have all of them. Windows and Mac preferred though.

Help! :) :)

[update] after 12 months of messing around (and not needing this in the end), the correct answer is, in my opinion, correct. Use git - have one repo which pulls from SVN-A, then push to a new git repo, then push from there to SVN-B. Should work :)

回答1:

I'd recommend SVK or git-svn.

Both of these let you create an external mirror of your svn repository, and allow the external devs to make commits directly to the external mirror. You can then pull and push changes from this external mirror to your internal master repo.

git-svn would (I think) require the external developers to use git. I prefer it, but I'd be reluctant to push this on others.

SVK, however, allows the external developers to continue using svn. Since the internal repo is only accessible internally, an internal account or user would have to handle the periodic syncronization (a cron job would probably work).

Here's an extended howto on the SVK wiki: UsingSVKAsARepositoryMirroringSystem



回答2:

Simplicity is usually the best way, and it sounds like you already have a simple solution: Use the SVN Repository outside the firewall.

You've already said machines inside the firewall can reach it, and obviously machines outside can reach it... so that's everyone, so what justification do you have for a second SVN repository inside the firewall? If it's just as a back-up, then just back-up the one on the outside.

Let me know if I'm missing part of your requirements.

Another thought... if you have both internal and external SVN instances... what is to stop them both giving out the same changelist ID at the same time, for different purposes? If you're seeking a de-centralised solution you should look towards GIT rather than SVN.



回答3:

One of the features of the Enterprise Edition of VisualSVN Server is Multisite Repository Replication that does exactly what you are looking for.

The feature is based on VisualSVN Distributed File System (VDFS) technology which was designed to enable transparent Subversion repository replication across geographically distributed sites. Some of the notable features of VDFS:

  • All distributed VDFS Subversion repositories are writable,
  • VDFS enables transparent bidirectional data replication,
  • VDFS supports replication authorization rules and advanced authentication mechanisms such as Integrated Windows Authentication (NTLM/Negotiate) with secure SSL/TLS encryption.
  • All VDFS repositories contain the same dataset,
  • Repository replication over WAN with VDFS is up to x10 faster than replication based on write-through proxy,
  • VDFS configuration is done via a graphical interface without any complicated steps.

It's worth noting that VDFS follows the classic master-slave replication model which has significant advantages over master-master replication model because it's more suitable for replicating Subversion repositories with FSFS fs-type backend. VDFS technology is much more reliable than master-master replication solutions for SVN.

  • VisualSVN Server | Multisite Repository Configuration,
  • Comparing VDFS with master-master replication solutions.



回答4:

Hmm...keeping two repos in sync with each other is non-trivial, I think. It would involve basically turning SVN into Mercurial or Git.



回答5:

The most seamless and scalable solution is the master/slave replication using svnsync that is described in the Subversion book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.serverconfig.httpd.extra.writethruproxy



回答6:

One thing you could try is to replicate the repo at file level. I am using FolderShare (http://www.foldershare.com - runs on Windows and Mac) for a similar scenario, though I am replicating it only for backup purposes and have not tried to connect using SVN to the replica.



回答7:

http://wandisco.com/subversion/multisite/

Subversion MultiSite leverages WANdisco's unique replication technology to immediately synchronize Subversion repositories connected over a wide area network (WAN). Users at every location experience local area network (LAN) speed performance for both read and write operations. Subversion MultiSite also provides continuous hot backup and self-healing capabilities that automate disaster recovery, so that downtime is virtually eliminated.



回答8:

If you are searching step by step explanation about master/slave replication using svnsync, please follow http://lasanthals.blogspot.com/2012/09/main-steps-of-configuring-svn_4.html