SVN version database lossless migration and automatic backup (2)

Source: Internet
Author: User

Next, I. SVN version database lossless migration and automatic backup (I)

Iii. Regular automatic backup version library Solution

1. Business objectives
 
① Remote automatic backup of the version library, back up the version library to another machine.
Assume that the source version library we want to synchronize is http: // 192.168.1.210/SVN/svnprojec located in machine A. The specific path does not need to be ignored because we use the HTTP protocol.
The target database is in machine B, file: // F:/repositories/svnproject. For simplicity and security, we use the file: // protocol.

② To back up the local version database, you only need to change the location of the above target database to the local location.
 
2. Related commands
 
Two commands are required to back up the version Library:

① Svnsync init
Initialize and establish the synchronization relationship between the target database and the source database.
Command Format: svnsync init target library URL source library URL

(There is a space between two URLs)

② Svnsync sync
Real Synchronization
Command Format: svnsync sync target library URL

3. Process example


(1) backup

① Create a version database on the machine to be backed up (if it is a local backup, create a version database locally): svnadmin create test1backup

② Enter the hooks directory of the source version library, for example, CDD: \ repositories \ testrepostitory \ hooks

③ Create a pre-revprop-change.bat file: copy the pre-revprop-change.tmpl, change the extension to the pre-revprop-change.bat, and clear all the original content, save.

④ Modify file: Modify the pre-revprop-change.tmpl file, open the file with notepad, change the Last Exit 1 file to exit 0

(The original script indicates that if the svn: log attribute is modified, the modification is allowed and 0 is returned. Otherwise, 1 is returned if the svn: log attribute is not modified, we want to change it to allow all attributes to be modified, and return 0 directly in the script)

⑤ Synchronization preliminary:
On the target machine, open the Command Prompt window, open the bin directory of the svn server, and run
Svnsync init file: // D:/repositories/test1backup https: // 192.168.0.110/SVN/test1
(You will be prompted to enter the user name and password. the user name and password provided here are computer passwords, user names and passwords that can be fully read from https: // 192.168.0.110/SVN/test1)

6. implement synchronization:
On the target machine, open the Command Prompt window, open the bin directory of the svn server, and run
Svnsyncsync file: // D:/repositories/test1backup
(If you are prompted to enter the user name and password, you can add the username and password parameters after this command.
That is, svnsync sync file: // D:/repositories/test1backup -- username -- Password)
 
Note:
Step 5 and Step 6 can be directly put together and written to a batch processing file (create a notepad, put the two sentences in step 5 and change the suffix of notepad. BAT), put the batch processing file into the bin directory of the svn server, and double-click to run it.In a moment, we will use this batch file for backup execution.
 
For local backup, you only need to change the target URL to the local database location. (For visualsvn, because one machine can only have one visualsvn server, all version libraries can only be identified by the server in one directory. In this way, backup can only be performed in the same directory, it does not seem to make much sense .)
 
If the version library is large, the backup time may be slow, and it may take several hours or a day,
After the backup is completed, you can open the target database and check that the source database is the same.
 
(2) Scheduled backup.
Here we use the Windows built-in task scheduler.

① Open the task scheduler on the Control Panel \ All control panel items \ management tools
Main Interface: Click Create task on the right

② Start to create a task. Under the General tab, we mainly set the basic information of the task. Here we can give the task a name, such as SVN synchronization.

③ Under the operations tab, click New. Here we can set the operations we want to perform. We need to back up the SVN version database and execute it. The backup batch file we just set up. This file should be stored in the bin directory of the svn Server Installation Directory (do not put it in the wrong place ). Click Browse to find the file.

④ Under the trigger tab, we can create a trigger. Here we can set the conditions for executing the operation just set. Make it run automatically.

⑤ Under the conditions and settings tab, you can set other conditions for executing the task and select one based on your situation.

Finally, make sure that the task for automatically backing up the SVN version library on a regular basis is successfully created.
 

Reminder: if the version library is not very large and less than 15 GB, you can create it in the Kingsoft fast disk directory and make it automatically backed up to the cloud.

Note: I am using the win7 flagship edition. It is similar to creating a task in the WINXP environment. I believe everyone can do it easily.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.