SERVICE 分離業務在雙網段上怎麼設定

gaopengtttt發表於2013-03-01

接下來測試下測試下如果要實現SERVICE 分離業務在雙網段上怎麼設定。

一、 測試配置問題
我們使用如下的語句(ORACLE使用者下)建立一個在3節點都啟用的SERVICE,同時設定自動啟動
[oracle@racc ~]$ srvctl add service -d racdb -s pub1 -r racdb1,racdb2,racdb3 -y AUTOMATIC –k1
[oracle@racc ~]$ srvctl add service -d racdb -s pub2 -r racdb1,racdb2,racdb3 -y AUTOMATIC –k2
這裡要指定network進行分離,因為我們現在有2套公有網路卡,如果其中一套其中一個機器的PUBLIC IP問題過後,這個機器的VIP進行FAILOVER,local listener 也就隨之停止,當然SACN VIP也進行了漂移,SCAN LISTENER 也在另外的機器啟動,這個時候這套PUBLIC IP是不能進行這個機器的例項的,但是另外一套IP卻沒有影響。

這裡報錯
[oracle@racc ~]$ srvctl add service -d racdb -s pub1 -r racdb1,racdb2,racdb3 -y AUTOMATIC –k1
PRCR-1006 : Failed to add resource ora.racdb.testall.svc for testall
PRCR-1071 : Failed to register or update resource ora.racdb.testall.svc
CRS-2566: User 'oracle' does not have sufficient permissions to operate on resource 'scanapp1', which is part of the dependency specification.
明顯報錯是由於許可權問題,這裡對比了許可權設定發現我們建立的SCANAPP VIP貌似有許可權問題
然後透過如下語句進行了修改,給與了other使用者的可執行許可權。
(PS:這裡要對RESOURCE的屬性比較熟悉才行)
[root@racc ~]# /oracle/app/grid/product/11.2.0/bin/crsctl modify resource scanapp2 -attr  "ACL='owner:root:rwx,pgrp:root:r-x,other::r-x,user:root:r-x'"
 [root@racc ~]# /oracle/app/grid/product/11.2.0/bin/crsctl modify resource scanapp2 -attr  "ACL='owner:root:rwx,pgrp:root:r-x,other::r-x,user:root:r-x'"
[root@racc ~]# /oracle/app/grid/product/11.2.0/bin/crsctl modify resource scanapp3 -attr  "ACL='owner:root:rwx,pgrp:root:r-x,other::r-x,user:root:r-x'"
{這裡順便把上面我們錯誤的LISTENER2的許可權改一下:
啟動階段修改
crsctl modify resource "ora.LISTENER2.lsnr" -attr  "ACL='owner:grid:rwx,pgrp:oinstall:rwx,other::r--'"
停止
srvctl stop listener –l LISTENER2
啟動
srvctl start listener –l  LISTENER2
這裡我還遇到了修改順序錯誤導致我的的LISTENER2資源在RACC節點為UNKOWN,無法CLEAN
ora.LISTENER2.lsnr
               ONLINE  ONLINE       raca                                        
               ONLINE  ONLINE       racb                                        
               ONLINE  UNKNOWN      racc  
隨後
crsctl modify resource "ora.LISTENER2.lsnr" -attr  "ACL='owner:root:rwx,pgrp:root:r-x,other::r--'"
然後停止,啟動後按照正常的順序進行才可以了,報錯如下:
[grid@racc ~]$ crsctl stop res ora.LISTENER2.lsnr -f
CRS-2679: Attempting to clean 'ora.LISTENER2.lsnr' on 'racc'
CRS-2680: Clean of 'ora.LISTENER2.lsnr' on 'racc' failed
CRS-5807: Agent failed to process the message
CRS-4000: Command Stop failed, or completed with errors.
}
然後再次增加SERVICE 看看
[oracle@racc ~]$ srvctl add service -d racdb -s pub1 -r racdb1,racdb2,racdb3 -y AUTOMATIC –k1
[oracle@racc ~]$ srvctl add service -d racdb -s pub2 -r racdb1,racdb2,racdb3 -y AUTOMATIC –k2

完成沒有問題。
啟動SERVICE
經過檢查兩個SCAN_LISTENER* LISTENER_SCAN* SCAN_LISTENERAPP*  都有如下的資訊
Service "testpub1" has 3 instance(s).
  Instance "racdb1", status READY, has 1 handler(s) for this service...
  Instance "racdb2", status READY, has 1 handler(s) for this service...
  Instance "racdb3", status READY, has 1 handler(s) for this service...
Service "testpub2" has 3 instance(s).
  Instance "racdb1", status READY, has 1 handler(s) for this service...
  Instance "racdb2", status READY, has 1 handler(s) for this service...
  Instance "racdb3", status READY, has 1 handler(s) for this service...
而各個節點的LISTENER1 LISTENER2
都有相關的資訊。
但是這個時候我們如果ifconfig bond0 down 會出現這樣的情況SCAN_LISTENERAPP* SCAN_LISTENER*都會如下
Service "testpub2" has 3 instance(s).
  Instance "racdb1", status READY, has 1 handler(s) for this service...
  Instance "racdb2", status READY, has 1 handler(s) for this service...
  Instance "racdb3", status READY, has 1 handler(s) for this service...
Service "testpub1" has 2 instance(s).
  Instance "racdb1", status READY, has 1 handler(s) for this service...
  Instance "racdb2", status READY, has 1 handler(s) for this service...
意思很明顯節點3的例項PUB1已經不能進入。所以我們在想用SERVICE進行業務分離的時候建立的SERVICE也必須和NETWORK 對應起來
所以連線我們應該這樣寫
RACSCAN2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = scantwo.gaopp.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = testpub2 )
    )
  )

RACSAN1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = scanone.gaopp.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = testpub1)
    )
  )

是不是覺得很煩。這就是為了做到這個要求需要的,資源很多,3節點對應6個VIP資源,6個LOCAL LISTENER,6個SCAN IP,6個SCAN LISTENER,而且每個庫需要建立2個SERVICE資源進行分離,如果在加上DISKGROUP的資源和多個資料庫的資源加上預設的資源資源大概會在60-70個左右。管理起來非常麻煩。要求很高。

二、 進行業務分離測試,並且測試SERVICE能否在節點重新啟動後隨VIP一起漂移回來。

[oracle@racc ~]$ srvctl add service -d racdb -s hrpub1 -r racdb3 -a racdb1,racdb2 -y automatic -k 1
[oracle@racc ~]$ srvctl add service -d racdb -s hrpub2 -r racdb3 -a racdb1,racdb2 -y automatic -k 2
[oracle@racc ~]$ srvctl start service -d racdb -s hrpub1
[oracle@racc ~]$ srvctl start service -d racdb -s hrpub2
這樣又多了2個資源,汗水。
ora.racdb.hrpub1.svc
      1        ONLINE  ONLINE       racc                                        
ora.racdb.hrpub2.svc
      1        ONLINE  ONLINE       racc     

直接DOWN掉bond1,出現一些問題,讓其vip,appvip,app scan listener,都漂移,本地LISTENER offline
ifconfig bond1 down
測試結果SERVICE 不能
三、 最後我恢復到了SCAN+VIP的模式進行測試
這樣不僅少了幾個資源,application VIP3個沒有了,SCAN LISTENER少了3個這樣更加簡單一些,維護也相對而言方便一些。
[oracle@racc ~]$ srvctl add service -d racdb -s hrpub1 -r racdb3 -a racdb1,racdb2 -y automatic -k 1
[oracle@racc ~]$ srvctl add service -d racdb -s hrpub2 -r racdb3 -a racdb1,racdb2 -y automatic -k 2
這裡要說明一下hrpub1是基於network1的,如果說network1的網段是172.16.14.0,而network2的網段是172.16.1.0,如果例項racdb3 172.16.14.113 這個機器的網路卡故障,那這個時候隨著發生的是VIP故障轉移,local listener 關閉,因為在NETWORK1 racdb3 已經不能進入所以service hrpub1進行轉移,同時SCAN VIP也漂移,SCAN_LISTENER也進行了漂移,SCAN_LISTENER上的註冊例項會取消掉racdb3而註冊為起備份的racdb1或者racdb2,但是這個時候NETWROK2卻沒有問題,hrpub2仍然在racdb3機器上的local listener進行註冊,註冊的例項任然是racdb3,不影響。

ora.racdb.hrpub1.svc
      1        ONLINE  ONLINE       racc                                        
ora.racdb.hrpub2.svc
      1        ONLINE  ONLINE       racc                             
正常情況下,
然後我們DOWN  172.16.14.113 所在bond0
[root@racc ~]# ifconfig bond0 down

ora.rac1vip.vip
      1        ONLINE  ONLINE       raca                                        
ora.rac2vip.vip
      1        ONLINE  ONLINE       racb                                        
ora.rac3vip.vip
      1        ONLINE  ONLINE       racc                                        
ora.raca.vip
      1        ONLINE  ONLINE       raca                                        
ora.racb.vip
      1        ONLINE  ONLINE       racb                                        
ora.racc.vip
      1        ONLINE  INTERMEDIATE racb                     FAILED OVER        

可以看到ora.racc.vip故障轉移了但是ora.rac3vip.vip沒有影響,
ora.LISTENER.lsnr
               ONLINE  ONLINE       raca                                        
               ONLINE  ONLINE       racb                                        
               ONLINE  OFFLINE      racc                                        
ora.LISTENER2.lsnr
               ONLINE  ONLINE       raca                                        
               ONLINE  ONLINE       racb                                        
               ONLINE  ONLINE       racc                                        
Listener1基於ora.racc.vip,OFFLINE了。
ora.racdb.hrpub1.svc
      1        ONLINE  ONLINE       raca                                        
ora.racdb.hrpub2.svc
      1        ONLINE  ONLINE       racc                                    
也和預計一樣。
檢視監聽

Service "hrpub1" has 1 instance(s).
  Instance "racdb1", status READY, has 1 handler(s) for this service...
Service "hrpub2" has 1 instance(s).
  Instance "racdb3", status READY, has 2 handler(s) for this service...
當然連線也就是

RACPUB2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.114)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.115)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.116)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = hrpub2)
    )
  )
RACPUB1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = scanone.gaopp.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = hrpub1)
    )
  )

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-755030/,如需轉載,請註明出處,否則將追究法律責任。

相關文章