RAC 某節點不可用時,對應VIP是否可用

實驗環境:RHEL 6.5 + GI 11.2.0.4 + Oracle 11.2.0.4
驗證:RAC 某節點不可用時,其對應VIP是否可用?是否可用於鏈接數據庫?html

[grid@jyrac2 ~]$ more /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#public ip
192.168.56.150  jyrac1
192.168.56.152  jyrac2
#private ip
10.10.10.11    jyrac1-priv
10.10.10.12    jyrac2-priv
#virtual ip
192.168.56.151  jyrac1-vip
192.168.56.153  jyrac2-vip
#scan ip
192.168.56.160  jyrac-scan

1.節點宕機,對應節點VIP漂移到另外一個節點

模擬主機jyrac1宕機,隨之該節點的VIP資源failed over。
此時在主機jyrac2查詢對應的資源信息以下:sql

[grid@jyrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA1.dg
               ONLINE  ONLINE       jyrac2                                       
ora.FRA1.dg
               ONLINE  ONLINE       jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac2                                       
ora.OCR1.dg
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               ONLINE  ONLINE       jyrac2                   Started             
ora.gsd
               OFFLINE OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac2                                       
ora.jyrac1.vip
      1        ONLINE  INTERMEDIATE jyrac2                   FAILED OVER         
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.jyzhao.db
      1        ONLINE  OFFLINE                               Instance Shutdown   
      2        ONLINE  ONLINE       jyrac2                   Open                
ora.oc4j
      1        ONLINE  ONLINE       jyrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2

2.節點宕機後,另外一個節點的網絡信息

查看在主機jyrac2網絡信息:數據庫

[grid@jyrac2 ~]$ ifconfig -a
eth2      Link encap:Ethernet  HWaddr 08:00:27:1A:5A:7A  
          inet addr:192.168.56.152  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1a:5a7a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3955 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8277 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:510869 (498.8 KiB)  TX bytes:692985 (676.7 KiB)

eth2:1    Link encap:Ethernet  HWaddr 08:00:27:1A:5A:7A  
          inet addr:192.168.56.153  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth2:2    Link encap:Ethernet  HWaddr 08:00:27:1A:5A:7A  
          inet addr:192.168.56.151  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth2:3    Link encap:Ethernet  HWaddr 08:00:27:1A:5A:7A  
          inet addr:192.168.56.160  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth3      Link encap:Ethernet  HWaddr 08:00:27:7C:CD:9F  
          inet addr:10.10.10.12  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe7c:cd9f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:116635 errors:0 dropped:0 overruns:0 frame:0
          TX packets:103705 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81979594 (78.1 MiB)  TX bytes:63727783 (60.7 MiB)

eth3:1    Link encap:Ethernet  HWaddr 08:00:27:7C:CD:9F  
          inet addr:169.254.198.12  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:145545 errors:0 dropped:0 overruns:0 frame:0
          TX packets:145545 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:130875345 (124.8 MiB)  TX bytes:130875345 (124.8 MiB)

3.可ping通宕機節點VIP,但無對應監聽

發現能ping通故障節點VIP,但並無對應的監聽程序。
ping能夠通,以下:網絡

[root@jyrac2 ~]# ping 192.168.56.151
PING 192.168.56.151 (192.168.56.151) 56(84) bytes of data.
64 bytes from 192.168.56.151: icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from 192.168.56.151: icmp_seq=2 ttl=64 time=0.036 ms
64 bytes from 192.168.56.151: icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from 192.168.56.151: icmp_seq=4 ttl=64 time=0.069 ms
^C
--- 192.168.56.151 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3229ms
rtt min/avg/max/mdev = 0.023/0.044/0.069/0.019 ms

沒有監聽,經過此VIP天然鏈接不上,以下:oracle

[root@jyrac2 ~]# sqlplus system/oracle@192.168.56.151/jyzhao

SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 3 16:58:31 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-12541: TNS:no listener


Enter user-name: 

#查看監聽,確認的確只有scan ip和節點2的ip和vip被監聽;節點1的vip的確是沒有被監聽。
[root@jyrac2 ~]# ps -ef|grep tns
root        15     2  0 09:05 ?        00:00:00 [netns]
grid      2845     1  0 09:07 ?        00:00:00 /opt/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid      6867     1  0 09:34 ?        00:00:00 /opt/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
root     13951 10953  0 17:17 pts/0    00:00:00 grep tns
[root@jyrac2 ~]# su - grid
[grid@jyrac2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 17:18:09

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                03-NOV-2016 09:07:20
Uptime                    0 days 8 hr. 10 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /opt/app/grid/diag/tnslsnr/jyrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.152)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.153)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "jyzhao" has 1 instance(s).
  Instance "jyzhao2", status READY, has 1 handler(s) for this service...
Service "jyzhaoXDB" has 1 instance(s).
  Instance "jyzhao2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 03-NOV-2016 17:18:18

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                03-NOV-2016 09:34:20
Uptime                    0 days 7 hr. 43 min. 58 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /opt/app/11.2.0/grid/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.160)(PORT=1521)))
Services Summary...
Service "jyzhao" has 1 instance(s).
  Instance "jyzhao2", status READY, has 1 handler(s) for this service...
Service "jyzhaoXDB" has 1 instance(s).
  Instance "jyzhao2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac2 ~]$

4.知識點總結

回到本文開頭提出的問題:
RAC 某節點不可用時,其對應VIP是否可用?是否可用於鏈接數據庫?
答:RAC 某節點不可用時,其對應VIP可ping通。但因爲沒有監聽,因此不可用於鏈接數據庫。app

最後思考下,VIP既然failover漂移後能夠ping通,但卻沒有對應的監聽程序致使節點故障時不能再用此節點的vip鏈接數據庫,那麼VIP設置的意義何在呢?
從網絡上搜索一些資料也能夠得知:
VIP 是在出現故障的時候保證不用等待底層的TCP/IP 協議來診斷斷開鏈接,而使用RAC級別來診斷,這樣會很快。
簡單舉例子來講,就是節點1故障後,其VIP會漂移到節點2;可是因爲節點2並無對節點1這個VIP地址進行監聽,這樣客戶端就能迅速知道節點1故障,從而切換到節點2;另外,須要注意的是,若是要實現failover,那麼tnsnames.ora中要有相應的配置。關於RAC的tnsnames.ora配置具體可參見Oracle RAC客戶端tnsnames.ora相關配置及測試dom

相關文章
相關標籤/搜索