1、131启动svn
svnserve -d -r /application/svndata/
2、132安装svn并创建库
yum install -y subversion
mkdir /application/
svnserve -d -r /application/
svnadmin create /application/svnback
3、修改目标库的脚本pre-revprop-change
cd /application/svnback/hooks/
cp pre-revprop-change.tmpl pre-revprop-change
vi pre-revprop-change
# 编辑pre-revprop-change钩子,将最后一行的 `exit 1` 改为 `exit 0`
chmod a+x pre-revprop-change
4、初始化
svnsync init file:///application/svnback/ svn://192.168.10.131/sadoc
[root@k8s02 hooks]# svnsync init file:///application/svnback/ svn://192.168.10.131/sadoc
Authentication realm: <svn://192.168.10.131:3690> 46cc3a34-e1e1-45b5-bdf4-a20ef78c2ca7
Password for 'root':
Authentication realm: <svn://192.168.10.131:3690> 46cc3a34-e1e1-45b5-bdf4-a20ef78c2ca7
Username: zhangsan
Password for 'zhangsan':
让输入root的密码,131的svn账号和密码
5、同步
svnsync sync --non-interactive file:///application/svnback/
[root@k8s02 db]# svn list file:///application/svnback/
a.txt
b.txt
c.txt
d.txt
e.txt
test.log
你好清晨.txt
6、设置自动同步钩子
k8s02需要设置一个同步的账号密码
cd /application/svnback/conf
[root@k8s02 conf]# cat svnserve.conf |grep -v '#'|grep -v ^$
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
[root@k8s02 conf]# cat passwd
[users]
zhaoliu = 123456
[root@k8s02 conf]# cat authz
[svnback:/]
zhaoliu = rw
k8s01需要设置钩子
cd /application/svndata/sadoc/hooks
cp post-commit.tmpl post-commit
chmod a+x post-commit
vi post-commit
将mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf删掉
添加内容
svnsync sync --non-interactive svn://192.168.10.132/svnback --sync-username zhaoliu --sync-password 123456
##--non-interactive #非交互式
观察变化
[root@k8s02 hooks]# svn list file:///application/svnback/