I want use svnsync
for create a back-up copy of my svn repository.
The svnsync command replicates all versioned files, and their attendant svn properties. It does not copy hooks or conf directories from the source repository, so I will need to do those manually.
I have wrote this batch script for create the backup repository:
setlocal enableextensions enabledelayedexpansion
:: create local backup project
svnadmin create C:\Repositories\Test
:: initialize local backup project with remote project
svnsync initialize https://local.com/svn/Test https://remote.com/svn/Test
:: get remote info project and store in info.txt
svn info https://remote.com/svn/Test>info.txt
:: get remote UUID project from info.txt
set UUID=
for /f "delims=" %%a in (info.txt) do (
set line=%%a
if "x!line:~0,17!"=="xRepository UUID: " (
set UUID=!line:~17!
)
)
:: set local UUID project with the remote UUID project
svnadmin setuuid C:\Repositories\Test %UUID%
:: sync local and remote project
svnsync sync https://local.com/svn/Test https://remote.com/svn/Test
endlocal
I have wrote this batch script for synchronize the backup repository with master repository (hourly schedule):
svnsync sync https://local.com/svn/Test https://remote.com/svn/Test
Say, if I set up a mirror svn repo via svnsync, and if my production svn server crashed, then how can i restore the production svn repo via the mirror? Is it possible?
Can someone suggest the best practice of backing up the production server using svnsync?
There are several options that are better than using svnsync
:
When you need to have a live backup or DR server for your Subversion repositories, consider deploying a replica (slave server) using the Multisite Repository Replication (VDFS) feature. For the more detailed getting started guidance please consider the KB136: Getting started with Multisite Repository Replication and KB93: Performing disaster recovery for distributed VDFS repositories articles.
When you want to backup your Subversion repositories, use the built-in Backup and Restore feature. The Backup and Restore feature helps you make daily backups of the repositories of any size and does not have any impact on performance and user operations. What is more, the Backup and Restore feature in VisualSVN Server is very easy to setup and maintain. Please, read the article KB106: Getting Started with Backup and Restore for setup instructions.
Don't forget to create background verification jobs, too. See the article KB115: Getting started with repository verification jobs.