With svnsync, you could set up a replica of your SVN repository. Apart from load balancing, the slave repo is also a backup of your master repo.
When in times you’d like to recover the master (we call it the original master) from the slave, you could follow these steps:
- Ensure no one is committing to SVN.
- Trigger svnsync in all SVN slaves.
- Stop the master’s SVN service.
- Duplicate your slave repo. We call the duplicate the new repo.
- Change the UUID of the new repo to that of the original master.
svnlook uuid <path to master repo> # Gives the master's UUID svnadmin setuuid <path to new repo> <master's UUID> svnlook uuid <path to new repo> # Check if it is set correctly
- In physical file system, backup and move away the original master. Move and rename the new repo to exactly that of the path of the original master.
- Remove the hook for the slave (in my case, the file <repo>/hooks/pre-revprop-change).
- Add back the hook for the master (in my case, the file <repo>/hooks/post-commit).
- Restart the SVN service.