CentOS 6.7 The default installation of Python is 2.6.6, you can first look at the Python version of your operating system, python-v;
Hot-backup.py is based on Python2 write, Python3 grammar Some places are different, so in Python3 not necessarily can run, I did not test, the students can test, the current Linux OS default installation of the Python version is 2
#/opt/subversion-1.9.3/tools/backup/hot-backup.py--help
usage:hot-backup.py [OPTIONS] Repos_path Backup_path
Create a backup of the repository at Repos_path in a subdirectory of
The backup_path location, named after the youngest revision.
Options:
--ARCHIVE-TYPE=FMT Create An archive of the backup. FMT can be one of:
Bz2:creates a bzip2 compressed tar file.
Gz:creates a gzip compressed tar file.
Zip:creates a compressed zip file.
Zip64:creates a Zip64 file (can be > 2GB).
--num-backups=n number of prior backups to keep around (0 to keep all).
--verify Verify the backup.
--help-h Print This help message and exit.
Backup command:
/opt/subversion-1.9.3/tools/backup/hot-backup.py--archive-type=gz--num-backups=7--verify/usr/local/data/svn/ repos/ui//usr/local/data/backup/
Can be added to a scheduled task:
Crontab-e
One task per line, one row for a warehouse.
SOURCE Analysis:
Print ("Backing Up repository to '" + Backup_subdir + "' ...")
Err_code = Subprocess.call ([Svnadmin, "Hotcopy", Repo_dir,
Backup_subdir, "--clean-logs"])
If Err_code! = 0:
Sys.stderr.write ("Unable to backup the repository.\n")
Sys.stderr.flush ()
Sys.exit (Err_code)
Else
Print ("Done.")
The script core is the use of Svnadmin Hotcopy is a full-scale backup, including the library's hook scripts, configuration files, etc.;
The advantage is that the backup process is fast and disaster recovery is fast, and if the SVN service is already set up on the backup machine and does not even need to be restored, simply configure it to switch to the backup repository.
The disadvantage is: more expensive hard disk, need to have large hard disk support. Now who cares about capacity AH ~ ~ ~ Haha, a few servers do not use space to find an open source Distributed file system to do a storage pool, enough of it.
Restore: Restore
Unpack the latest backup files first
#svnadmin hotcopy/usr/local/data/backup/The extracted backup file/usr/local/data/svn/repos/ui/
About the SVN migration, and the need to move out multiple repositories by directory keyword for a total library, and to restart the commit version of the requirement you can contact me and leave me a message.
SVN official backup hot-backup.py highly recommended