标签:
为了安全起见,SVN服务器除了做定时全量备份和增量备份以外,如条件允许,可做实时备份。
这需要2台机器,一台是master server,另一台做mirror server。master做主服务,mirror不对外服务或设置只读(除了同步账号可写外)
另外如果master负载比较高,可以把一些只读的应用设置为从mirror读取,例如Jenkins编译。(需保证实时同步一直工作)
if [ "$USER" = "svnsync" ]; then exit 0; fi
echo "Only the svnsync user can change revprops" >&2
#!/usr/bin/python
#coding=utf-8
import os
import commands
import sys
import logging
def init_log(log_level,logpath):
logger = logging.getLogger()
‘‘‘
from logging.handlers import RotatingFileHandler
ro_hdlr=RotatingFileHandler(logpath, maxBytes=0,backupCount=5)
logger.addHandler(ro_hdlr)
ro_hdlr.doRollover()
‘‘‘
hdlr = logging.FileHandler(logpath)
formatter = logging.Formatter(‘%(asctime)s [%(levelname)-8s %(module)s:%(lineno)d] %(message)s‘)
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(log_level)
return logger
repos=os.path.basename(sys.argv[1])
log=init_log(0,‘/data/svnsynclog/‘ + repos + ‘_sync.log‘)
log.info("*"*20+repos)
output=commands.getoutput(‘/usr/bin/svnsync sync --non-interactive --username svnsync --password svnsync http://10.0.80.21/svn/‘+repos)
log.info(‘sync log :‘+output)
OK, 完成。
svnsync init --username svnsync http://10.0.80.21/svn/test http://10.0.80.20/svn/test
svnsync sync --username svnsync http://10.0.80.21/svn/test
标签:
原文地址:http://www.cnblogs.com/liangjichen/p/4478221.html