本文档介绍如何在PCRFClient01和PCRFClient02之间同步Subversion控制(SVN)存储库。
策略生成器(PB)中的所有策略配置都存储为SVN存储库。因此,要获得高可用性(HA),您需要在两个PCRFClient虚拟机(VM)上具有相同的SVN通用唯一标识符(UUID)。 但是,思科策略套件(CPS)版本7.X在PCRFClient VM中没有相同的UUID。也就是说,较高的CPS版本具有相同的UUID。已输入增强Bug(Cisco Bug ID CSCuu85319)。如果两个PCRFClient0X VM中的修订版号相同,则可以实现HA。
由于UUID在两个PCRFClient VM上不同,请输入以下命令:
svn info http://pcrfclient01/repos/configuration
svn info http://pcrfclient02/repos/configuration
您可能会注意到这些Quantum Network suite(QNS)错误日志。可以使用脚本svn_uuid_mismatch.sh检查这些错误消息。本文末尾提供了此脚本。
==qns-1.log==
2015-06-10 00:51:15,058 [pool-4-thread-1] WARN
c.b.r.impl.ReferenceDataManager - SVN directory failed in updating
2015-06-10 01:51:44,050 [pool-4-thread-1] WARN
c.b.r.impl.ReferenceDataManager - SVN directory failed in updating
2015-06-10 03:52:41,061 [pool-4-thread-1] WARN
c.b.r.impl.ReferenceDataManager - SVN directory failed in updating
==Service-qns-1.log==
svn: Repository UUID '70e98d90-b9c7-4c5b-a3db-681dd68c62a6'
doesn't match expected UUID 'ed2f2f76-f588-443e-9bb8-3fb05abd903b'
svn: Repository UUID '70e98d90-b9c7-4c5b-a3db-681dd68c62a6'
doesn't match expected UUID 'ed2f2f76-f588-443e-9bb8-3fb05abd903b'
svn: Repository UUID '70e98d90-b9c7-4c5b-a3db-681dd68c62a6'
doesn't match expected UUID 'ed2f2f76-f588-443e-9bb8-3fb05abd903b'
如下所示,您可以看到UUID在VM中不同,但版本必须保持相同。如果PCRFClient VM中的SVN版本相同,则SVN存储库同步已到达,并且您随后拥有高可用性。
===PCRFClient01===
[root@pcrfclient01 ~]# svn info http://pcrfclient01/repos/configuration
Path: configuration
URL: http://pcrfclient01/repos/configuration
Repository Root: http://pcrfclient01/repos
Repository UUID: ed2f2f76-f588-443e-9bb8-3fb05abd903b
Revision: 392 <<<< revision number
Node Kind: directory
Last Changed Author: broadhop
Last Changed Rev: 392
Last Changed Date: 2015-06-01 15:52:12 -0600 (Mon, 01 Jun 2015)
===PCRFClient02===
[root@pcrfclient01 ~]# svn info http://pcrfclient02/repos/configuration
Path: configuration
URL: http://pcrfclient02/repos/configuration
Repository Root: http://pcrfclient02/repos
Repository UUID: 70e98d90-b9c7-4c5b-a3db-681dd68c62a6
Revision: 392 <<<< revision number
Node Kind: directory
Last Changed Author: broadhop
Last Changed Rev: 392
Last Changed Date: 2015-06-01 15:52:12 -0600 (Mon, 01 Jun 2015)
上一节介绍了如何检查SVN存储库同步。本节讨论如何修复SVN同步。假设PCRFClient01是主,而PCRFClient02是辅助,并且PCRFClient02 SVN存储库不同步。
要使PCRFClient02 SVN存储库与PCRFClient01同步,请完成以下步骤:
crontab -e
Comment this cron job entry:
/usr/bin/svnsync sync http:// pcrfclient02/repos-proxy-sync
<Location /repos-proxy-sync>
DAV svn
SVNPath /var/www/svn/repos
Order deny,allow
Deny from all
Allow from pcrfclient01 <<< # customer host name of PCRFClient01 VM
</Location>
service httpd restart
/usr/bin/svnsync sync http://pcrfclient02/repos-proxy-sync
如果报告了锁错误,请输入此命令,然后重试svnsync命令:
/usr/bin/svn propdel svn:sync-lock --revprop -r 0 http:// pcrfclient02/repos-proxy-sync
如果仍然看到错误,请继续执行“重新初始化SVN同步”操作。
crontab -e
/usr/bin/svnsync sync http://pcrfclient02/repos-proxy-sync
仅当在“修复SVN存储库同步”一节的步骤4中遇到错误时,才执行这些步骤。如果在上一节中未遇到任何错误,可以忽略这些步骤。
listen svn_proxy lbvip02:80
mode http
balance roundrobin
option httpchk
option httpclose
option abortonclose
server pcrfclient01 pcrfclient01:80 check
#server pcrfclient02 pcrfclient02:80 check backup
/etc/init.d/heartbeat restart
listen svn_proxy lbvip02:80
mode http
balance roundrobin
option httpchk
option httpclose
option abortonclose
server pcrfclient01 pcrfclient01:80 check
#server pcrfclient02 pcrfclient02:80 check backup
/etc/init.d/heartbeat restart
tar -czf /var/tmp/repos.tar.gz /var/www/svn/repos
mkdir -p /var/www/svn/repos
rmdir /var/www/svn/repos
/usr/bin/svnadmin create /var/www/svn/repos
chown -R apache:apache /var/www/svn/repos
#!/bin/sh
#/var/www/svn/repos/hooks/pre-revprop-change
exit 0
chmod 700 /var/www/svn/repos/hooks/pre-revprop-change
chown apache:apache /var/www/svn/repos/hooks/pre-revprop-change
service httpd restart
/usr/bin/svnsync init http://pcrfclient02/repos-proxy-sync
http:// pcrfclient01/repos-proxy-sync
/usr/bin/svnsync sync http:// pcrfclient02/repos-proxy-sync
listen svn_proxy lbvip02:80
mode http
balance roundrobin
option httpchk
option httpclose
option abortonclose
server pcrfclient01 pcrfclient01:80 check
server pcrfclient02 pcrfclient02:80 check backup
/etc/init.d/heartbeat restart
listen svn_proxy lbvip02:80
mode http
balance roundrobin
option httpchk
option httpclose
option abortonclose
server pcrfclient01 pcrfclient01:80 check
server pcrfclient02 pcrfclient02:80 check backup
/etc/init.d/heartbeat restart
crontab -e/usr/bin/svnsync sync http://pcrfclient02/repos-proxy-sync
请将此脚本放入CPS系统,以检查PCRFClient VM间的SVN同步。
#!/bin/bash
a=$(svn info http://pcrfclient01/repos/configuration | grep -i Revision | grep -o '[0-9]*')
b=$(svn info http://pcrfclient02/repos/configuration | grep -i Revision | grep -o '[0-9]*')
if [ "$a" == "$b" ]; then
echo -e "SVN repository Synchronization:\e[0;32m PASS \e[0m"
echo -e "PCRFClient01 SVN repository revision number is : \e[1;33m $a \e[0m"
echo -e "PCRFClient02 SVN repository revision number is : \e[1;33m $b \e[0m"
else
echo -e "SVN repository Synchronization :\e[0:31m FAIL \e[0m"
echo -e "PCRFClient01 SVN repository revision number is : \e[1;33m $a \e[0m"
echo -e "PCRFClient02 SVN repository revision number is : \e[1;33m $b \e[0m"
fi
请将此脚本放在CPS系统中,以监控来自单个QNS VM的SVN UUID相关错误消息。
#!/bin/bash
for HN in `hosts.sh |grep qns`;
do echo -e "\e[1;32m $HN\e[0m";
echo -e "\e[1;33m===qns-1.log===\e[0m"
ssh $HN grep -wh "SVN directory failed" 2>/dev/null /var/log/broadhop/qns-1.log | tail -10;
echo -e "\e[1;33m===service-qns-1.log===\e[0m"
ssh $HN grep -wh "match expected UUID" 2>/dev/null /var/log/broadhop/service-qns-1.log | tail -10;
done
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
31-Aug-2015 |
初始版本 |