svn backup, restore and migration one-stop solution

Backup

Preface

Take the name of the library to be backed up here testas an example

purpose

When the svn server has a catastrophic failure, we can use the backup file to restore the company’s assets: svn code

The status quo

The entire svn backup file is very large. If you perform a full backup each time, it will consume a lot of hard disk resources.

solution

Use a full backup + incremental backup scheme; perform a remote backup of the svn code
for a full backup on the 1st of each month, and perform a differential backup at other times

1: Full backup steps

  • 1. Use svnadmin dump repository path> dumpfile

    svnadmin dump /data/svn/test > /data/backup/svn/test_dumpfile
  • 2. Use the command to get the number of submitted versions of the warehouse, and prepare the
    svnlook youngest warehouse path for subsequent increments ;
    [root@localhost svn]# svnlook youngest /data/svn/test/
    73988

    Remarks: 73988is the number of versions submitted in the current warehouse

Two: incremental backup steps

  • 1. The number of svn versions of the backup difference The number of svn versions of the
    last full backup: 73881; there are now 73988 versions, and the difference in the middle is: 73882-73988 (+1 on the basis of the full backup)
    svnadmin dump /data/svn/test -r 73882:73988 --incremental > /data/backup/svn/test_dumpfile_73882-73988

Summary of backup strategies

Start the backup at 1:00 in the morning, first use to svnlook youngestget the version number, and then fully compress the backup. Record the version number of the full backup. In the next incremental backup, you can use the version number+1 for differential backup

Restore data

background

Above we have backed up svnadmin dumpthe svn warehouse through the official backup tool of svn; now we restore the data

Operating environment

  • 1. Prepare svn backup data: generally contain full files and incremental backup files
  • 2. Prepare a machine and build svn on it

Full reduction steps

  • 1. Execute the import command

    Import the full backup data to the svn built on the new machine

    svnadmin load /data/svn/test/ < /data/backup/svn/test_dumpfile
  • 2. Check the svn version number; see that the restore is successful
    [root@localhost svn]# svnlook youngest /data/svn/test/
    73881
  • 3. Confirm the content of svn's submission log, whether there is a problem
  • 4. Check with classmates who use svn to confirm if there are any problems

Incremental restore steps

  • 1. The incremental backup file is:/data/backup/svn/test_dumpfile_73881-73988
svnadmin load /data/svn/test/ < /data/backup/svn/test_dumpfile_73881-73988
  • 2. When we see Committed new rev 73989 (loaded from original rev 73988), it means the restoration is successful
  • 3. Use svnlook again to view the submitted version number
[root@localhost svn]# svnlook youngest /data/svn/test/
73988

Summary of migration plan:

First use the full backup, and then use the incremental backup to restore, and finally confirm with the client development classmates: whether the restored svn data can be used normally.

Migration

Preface

svn://192.168.1.1/testIt contains all of the company’s project A, project B, and project C (except for the client code); it is not convenient for direct use

method:

In order to better distinguish the project, the different projects use different repositories; from testsandwiched in independent sub-file:

  • Project A
  • Project B
  • Project C

Migration principles:

Try to have as little impact on project development as possible;

Migration destination machine

192.168.1.2; this machine is used as svn restore

Migration steps:

1. First use the full amount to restore the data
. 2. Use the incremental backup file to restore the difference part (usually 1 day of data)

Do a full restoration first

1. Send a notice in the second group of the project: the svn repository will be maintained on weekends and will be suspended on weekends

2. Use the complete backup file to filter out the required folders

svndumpfilter include 项目A < test_bak_0-90769 > 项目A_dumpfile
svndumpfilter include 项目B < test_bak_0-90769 > 项目B_dumpfile
# 如果包含了多个文件夹,可以用空格+文件夹名,代表多个目录
svndumpfilter include 项目C 17_项目C < test_bak_0-90769 > 项目C_dumpfile

3. 192.168.1.2Create a new version library

svnadmin create /data/svn/项目A
svnadmin create /data/svn/项目B
svnadmin create /data/svn/项目C

4. Prepare the authorization and
prepare the information of the personnel in use, and write it into the authorization file of the new version library.
5. Use the file in step 1 for data recovery


svnadmin load /data/svn/项目A < 项目A_dumpfile
svnadmin load /data/svn/项目B < 项目B_dumpfile
svnadmin load /data/svn/项目C < 项目C_dumpfile

Perform differential restore through incremental backup

1.准备差异文件
2.将差异部分进行还原
3.验证差异部分

6. After verifying that there is no problem. Hide the files on the old machine and
move them to an unused folder; delete them after 7/14 days after confirming that there is no effect

Guess you like

Origin blog.51cto.com/12131824/2546235