SVN迁移及备份
1、旧服务器操作
- 安装apache
yum install httpd mod_dav_svn -y
cd /etc/httpd/conf.d/
vim subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule dontdothat_module modules/mod_dontdothat.so
<Location /svn>
DAV svn
SVNPath /home/svn/TPH
AuthType Basic
AuthName "Authorization SVN"
AuthzSVNAccessFile /home/svn/authz
AuthUserFile /home/svn/passwd
Require valid-user
</Location>
- 生成authz 和passwd认证
cat authz
[/]
admin = rw
[TPH:/] #要迁移的仓库
admin = rw 迁移的用户权限
htpasswd -c /home/svn/passwd admin
htpasswd -b /home/svn/passwd ganchang 123 第二次增加用户输入
cat passwd
admin:4cyzrsRzvV9CQ
- 重启httpd
systemctl restart httpd
2、新服务器操作
- 本地创建仓库
svnadmin create TPH
cd TPH/hooks
cp pre-revprop-change.tmpl pre-revprop-change
chmod 777 pre-revprop-change
vim pre-revprop-change
- 修改最后一行
exit 1 为exit 0
-
同步svn
` svnsync init file:///data/svn/TPH http://旧服务器/svn
-
同步输入设置好的账号密码
svnsync sync file:///data/svn/TPH
- 可校验版本
svnadmin verify /data/svn/TPH
3、SVN备份
本地机器 10.100.0.1
远端机器 10.100.0.2 ---从本地机器备份到远程机器
现在远程机器创建同名仓库并配置hooks并添加好备份账户及权限
svnadmin create Project
cd Project/hooks
cp pre-revprop-change.tmpl pre-revprop-change
chmod +x pre-revprop-change
vim pre-revprop-change
#!/bin/sh
exit 0
备份脚本:
#!/bin/bash
time=`date +%Y-%m-%d`
echo "-------------------------------------------$time---------------------------------------" >>/tmp/Projectbak.log
svnsync init --allow-non-empty svn://10.100.0.2/Project svn://10.100.0.1/Project --username zhangsan --password 123456
svnsync sync svn://10.100.0.2/Project --username zhangsan --password 123456 >>/tmp/Projectbak.log
echo "-------------------------------------------$time---------------------------------------" >>/tmp/Projectbak.log