11gr2 rac改IP系列之二:修改VIP為同網段其它IP

還不算暈發表於2016-11-29
--------------------------
修改vip為同網段(子網掩碼不變)其它IP,公網網路卡資訊保持不變。
-----------------修改前:
192.168.57.216 bys1-vip.bys.com bys1-vip
192.168.57.218 bys2-vip.bys.com bys2-vip
-----------------修改後:
192.168.57.116 bys1-vip.bys.com bys1-vip
192.168.57.118 bys2-vip.bys.com bys2-vip
參考MOS文件:如何修改叢集的公網資訊(包括 VIP) (文件 ID 1674442.1)
--------目錄
1.檢視當前的VIP配置資訊及叢集及OS層面網路卡資訊
2.停止VIP資源並檢查叢集及OS層面網路卡資訊
3.修改/etc/hosts中記錄(兩個節點均修改)--IP由216改為116
4.修改OCR中VIP資源的資訊--root使用者
5.檢查VIP資源資訊並啟動VIP資源及監聽、資料庫資源--如果資料庫例項也關閉了
6.VIP配置資訊及叢集及OS層面網路卡資訊--VIP/監聽均正常
7.修改ASM及資料庫例項的local_listener引數
如果改完VIP後,重新啟動了資料庫例項,則不需要改資料庫例項的local_listener引數。
在資料庫例項(ASM例項由叢集重啟時同樣)啟動時,會自動使用OCR中的VIP資訊來設定例項的local_listener引數。

以上的修改可以使用滾動的方式完成,例如:每次修改一個節點。
---------------------------
###########################
---------------------------
具體步驟:--僅顯示節點1,節點2同樣步驟。

1.檢視當前的VIP配置資訊及叢集及OS層面網路卡資訊
[grid@bys1 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.57.0/255.255.255.0/eth0, type static
VIP exists: /bys1-vip/192.168.57.216/192.168.57.0/255.255.255.0/eth0, hosting node bys1
VIP exists: /bys2-vip/192.168.57.218/192.168.57.0/255.255.255.0/eth0, hosting node bys2
[grid@bys1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.asm
               ONLINE  ONLINE       bys1                     Started             
               ONLINE  ONLINE       bys2                     Started             
ora.gsd
               OFFLINE OFFLINE      bys1                                         
               OFFLINE OFFLINE      bys2                                         
ora.net1.network
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.ons
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       bys1                                         
ora.bys1.vip
      1        ONLINE  ONLINE       bys1                                         
ora.bys2.vip
      1        ONLINE  ONLINE       bys2                                         
ora.cvu
      1        ONLINE  ONLINE       bys2                                         
ora.oc4j
      1        ONLINE  ONLINE       bys2                                         
ora.scan1.vip
      1        ONLINE  ONLINE       bys1                                         

[grid@bys1 ~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.215  Bcast:192.168.57.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe29:4bb4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:972 errors:0 dropped:0 overruns:0 frame:0
          TX packets:324 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:143661 (140.2 KiB)  TX bytes:54192 (52.9 KiB)

eth0:1    Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.216  Bcast:192.168.57.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

###############
2.停止VIP資源並檢查叢集及OS層面網路卡資訊
從 10.2.0.3 開始,ASM 和資料庫例項對 VIP 資源的依賴關係已經被刪除,所以修改 VIP 不需要停止 ASM 和資料庫例項,只有當修改 VIP 時產生的客戶端連線會受影響。如果修改只涉及到特定的節點,那麼只有連線到對應節點的客戶端連結在修改時會受影響。
---
[grid@bys1 ~]$ srvctl stop vip -n bys1 -f
[grid@bys1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.LISTENER.lsnr
               OFFLINE OFFLINE      bys1     ------節點1的監聽已經關閉--監聽依賴於VIP資源                                    
               ONLINE  ONLINE       bys2                                         
ora.asm
               ONLINE  ONLINE       bys1                     Started             
               ONLINE  ONLINE       bys2                     Started             
ora.gsd
               OFFLINE OFFLINE      bys1                                         
               OFFLINE OFFLINE      bys2                                         
ora.net1.network
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.ons
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       bys1                                         
ora.bys1.vip
      1        OFFLINE OFFLINE                ------節點1VIP資源已關閉                                      
ora.bys2.vip
      1        ONLINE  ONLINE       bys2                                         
ora.cvu
      1        ONLINE  ONLINE       bys2                                         
ora.oc4j
      1        ONLINE  ONLINE       bys2                                         
ora.scan1.vip
      1        ONLINE  ONLINE       bys1                                         
[grid@bys1 ~]$ ifconfig  --OS層面檢視VIP的已經不存在
eth0      Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.215  Bcast:192.168.57.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe29:4bb4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1081 errors:0 dropped:0 overruns:0 frame:0
          TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:152176 (148.6 KiB)  TX bytes:70753 (69.0 KiB)

eth0:2    Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.219  Bcast:192.168.57.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

###############
3.修改/etc/hosts中記錄(兩個節點均修改)--IP由216改為116
改之前
192.168.57.216 bys1-vip.bys.com bys1-vip
改之後
192.168.57.116 bys1-vip.bys.com bys1-vip

###############
4.修改OCR中VIP資源的資訊--root使用者
[root@bys1 ~]# srvctl modify nodeapps -n bys1 -A bys1-vip/255.255.255.0/eth0

###############
5.檢查VIP資源資訊並啟動VIP資源及監聽、資料庫資源--如果資料庫例項也關閉了
[grid@bys1 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.57.0/255.255.255.0/eth0, type static
VIP exists: /bys1-vip/192.168.57.116/192.168.57.0/255.255.255.0/eth0, hosting node bys1
VIP exists: /bys2-vip/192.168.57.218/192.168.57.0/255.255.255.0/eth0, hosting node bys2
[grid@bys1 ~]$ srvctl start vip -n bys1
[grid@bys1 ~]$ srvctl start listener -n bys1

###############
6.VIP配置資訊及叢集及OS層面網路卡資訊--VIP/監聽均正常
[grid@bys1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.asm
               ONLINE  ONLINE       bys1                     Started             
               ONLINE  ONLINE       bys2                     Started             
ora.gsd
               OFFLINE OFFLINE      bys1                                         
               OFFLINE OFFLINE      bys2                                         
ora.net1.network
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.ons
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       bys1                                         
ora.bys1.vip
      1        ONLINE  ONLINE       bys1                                         
ora.bys2.vip
      1        ONLINE  ONLINE       bys2                                         
ora.cvu
      1        ONLINE  ONLINE       bys2                                         
ora.oc4j
      1        ONLINE  ONLINE       bys2                                         
ora.scan1.vip
      1        ONLINE  ONLINE       bys1                                         
[grid@bys1 ~]$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.215  Bcast:192.168.57.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe29:4bb4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1424 errors:0 dropped:0 overruns:0 frame:0
          TX packets:679 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:183151 (178.8 KiB)  TX bytes:99652 (97.3 KiB)

eth0:1    Link encap:Ethernet  HWaddr 08:00:27:29:4B:B4  
          inet addr:192.168.57.116  Bcast:192.168.57.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

###############
7.修改ASM及資料庫例項的local_listener引數
如果改完VIP後,重新啟動了資料庫例項,則不需要改資料庫例項的local_listener引數。
在資料庫例項啟動時,會自動使用OCR中的VIP資訊來設定例項的local_listener引數。ALERT日誌中輸出如下:
Sun Nov 27 21:49:24 2016
ALTER SYSTEM SET local_listener=' (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.57.116)(PORT=1521))' SCOPE=MEMORY SID='bysrac1';
ALTER DATABASE MOUNT /* db agent *//* {1:30982:359} */

在叢集重啟,ASM例項也重啟時,會自動使用OCR中的VIP資訊來設定例項的local_listener引數。ALERT日誌中有如下輸出:
Sun Nov 27 21:57:04 2016
ALTER SYSTEM SET local_listener=' (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.57.116)(PORT=1521))))' SCOPE=MEMORY SID='+ASM1';


建議檢查local_listener引數,如ASM未重啟,需要手動設定:
alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.57.116)(PORT=1521)))';

-------------檢查監聽狀態
[grid@bys1 ~]$ lsnrctl status

相關文章