本文檔介紹如何在PCRFClient01和PCRFClient02之間同步Subversion控制元件(SVN)儲存庫。
策略生成器(PB)中的所有策略配置均儲存為SVN儲存庫。因此,為了具有高可用性(HA),您需要兩個PCRFClient虛擬機器(VM)具有相同的SVN通用唯一識別符號(UUID)。 但是,思科策略套件(CPS)版本7.X在PCRFClient VM之間沒有相同的UUID。也就是說,較高的CPS版本具有相同的UUID。已輸入增強功能錯誤,思科錯誤ID CSCuu85319。如果兩個PCRFClient0X VM的修訂版號相同,則可能會達到HA。
由於兩個PCRFClient VM的UUID不同,請輸入以下命令:
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'
如下圖所示,您可以觀察到各個VM的UUID不同,但版本必須相同。如果兩個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虛擬機器的與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 |
初始版本 |