ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11gR2 11.2.0.3 RAC DNS-VIP配置及测试

11gR2 11.2.0.3 RAC DNS-VIP配置及测试

原创 Linux操作系统 作者:DBA_oracle_java 时间:2013-09-06 09:58:41 0 删除 编辑

11gR2 11.2.0.3 RAC DNS-VIP配置及测试

参考文档:

http://www.oracle.com/technetwork/products/clustering/overview/scan-129069.pdf

http://www.luocs.com/archives/281.html

1.相关理论

看下oracle官方给出scan ip的解释

SCAN(Single Client Access Name)oracle 11gR2中出来的新特性。客户端可以通过经过DNS解析过的scan名称负载均衡地连接到oracle RAC,或者使用ORACLE GNS

我们选择DNS的方式解析scan ip

有三点需要注意:

1.分配三个地址,Oracle grid infrastructure在安装的时候,监听会为每一个SCAN IP创建一个SCAN LISTENER.:

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       stu202                                       

ora.LISTENER_SCAN2.lsnr

      1        ONLINE  ONLINE       stu201                                      

ora.LISTENER_SCAN3.lsnr

      1        ONLINE  ONLINE       stu201                                      

ora.cvu

 

2.scan ipIP地址需要和VIPIP地址在同一个网段,如:

[root@stu201 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       stu201          localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

#public

192.168.20.111  stu201

192.168.20.112  stu202

 

#private

10.0.0.111     stu201-priv

10.0.0.112     stu202-priv

 

#vip

192.168.20.113 stu201-vip

192.168.20.114 stu202-vip

 

#scan

#192.168.20.117 stu02-scan

#192.168.20.118 stu02-scan

#192.168.20.119 stu02-scan

####DNS-VIP 不使用hosts文件解析,所以注释掉了,这里只是为了方便查阅。需要在DNS服务器的正向查找区域新建三个stu02-scan的信息

 

同时需要在rac的两个节点中配置DNS解析

[root@stu201 ~]# cat /etc/resolv.conf

; generated by /sbin/dhclient-script

search szsckj.com

nameserver 192.168.50.251

 

[root@stu202 ~]# cat /etc/resolv.conf

; generated by /sbin/dhclient-script

search szsckj.com

nameserver 192.168.50.251

 

[root@stu201 ~]# nslookup stu02-scan.szsckj.com

Server:         192.168.50.251

Address:        192.168.50.251#53

 

Name:   stu02-scan.szsckj.com

Address: 192.168.20.118

Name:   stu02-scan.szsckj.com

Address: 192.168.20.117

Name:   stu02-scan.szsckj.com

Address: 192.168.20.119

 

这里的192.168.50.251就是DNS服务器的IP地址

 

[root@stu201 ~]# ping stu02-scan.szsckj.com ###这里是RAC搭建好之后ping的操作,故通

PING stu02-scan.szsckj.com (192.168.20.118) 56(84) bytes of data.

64 bytes from 192.168.20.118: icmp_seq=1 ttl=64 time=0.034 ms

64 bytes from 192.168.20.118: icmp_seq=2 ttl=64 time=0.066 ms

64 bytes from 192.168.20.118: icmp_seq=3 ttl=64 time=0.037 ms

64 bytes from 192.168.20.118: icmp_seq=4 ttl=64 time=0.035 ms

64 bytes from 192.168.20.118: icmp_seq=5 ttl=64 time=0.041 ms

3.scan ip的名称在网络中需要是唯一的

2.grid infrastructure安装使用DNS解析SCAN VIP

NER

 

 

 

安装好之后检查crs状态可以看到集群为我的3IP创建了3个监听,同时也会必然在某一个节点有两个SCAN LISTENER

[root@stu201 ~]# crsctl status resource -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       stu201                                      

               ONLINE  ONLINE       stu202                                      

ora.DBFS.dg

               ONLINE  ONLINE       stu201                                      

               ONLINE  ONLINE       stu202                                      

ora.LISTENER.lsnr

               ONLINE  ONLINE       stu201                                      

               ONLINE  ONLINE       stu202                                      

ora.asm

               ONLINE  ONLINE       stu201                   Started            

               ONLINE  ONLINE       stu202                   Started            

ora.gsd

               OFFLINE OFFLINE      stu201                                      

               OFFLINE OFFLINE      stu202                                      

ora.net1.network

               ONLINE  ONLINE       stu201                                      

               ONLINE  ONLINE       stu202                                      

ora.ons

               ONLINE  ONLINE       stu201                                       

               ONLINE  ONLINE       stu202                                      

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       stu202                                      

ora.LISTENER_SCAN2.lsnr

      1        ONLINE  ONLINE       stu201                                      

ora.LISTENER_SCAN3.lsnr

      1        ONLINE  ONLINE       stu201                                      

ora.cvu

      1        ONLINE  ONLINE       stu201                                      

ora.oc4j

      1        ONLINE  ONLINE       stu201                                       

ora.regan.db

      1        ONLINE  ONLINE       stu201                   Open               

      2        ONLINE  ONLINE       stu202                   Open               

ora.scan1.vip

      1        ONLINE  ONLINE       stu202                                       

ora.scan2.vip

      1        ONLINE  ONLINE       stu201                                      

ora.scan3.vip

      1        ONLINE  ONLINE       stu201                                      

ora.stu201.vip

      1        ONLINE  ONLINE       stu201                                      

ora.stu202.vip

      1        ONLINE  ONLINE       stu202

 

3.DNS VIP解析SCNA IP测试

官方的文档说:在测试11gR2 RAC SCAN IP的特性的时候,我们需要注意客户端的版本对测试的影响。oracle要求你的服务器端和客户端的版本都为11g,这样的话,我们可以完全使用11gR2 SCAN IP 的特性。如客户端的版本低于11g,则需要做特别的属性指定。

3.1 loadbalance

将客户端的机器DNS设置为192.168.50.251

测试修改成功:

##查看SCNAL LISTENER分布情况

oracle@stu202:/home/oracle>srvctl status scan

SCAN VIP scan1 is enabled

SCAN VIP scan1 is running on node stu201

SCAN VIP scan2 is enabled

SCAN VIP scan2 is running on node stu202

SCAN VIP scan3 is enabled

SCAN VIP scan3 is running on node stu202

oracle@stu202:/home/oracle>srvctl status scan_listener

SCAN Listener LISTENER_SCAN1 is enabled

SCAN listener LISTENER_SCAN1 is running on node stu201

SCAN Listener LISTENER_SCAN2 is enabled

SCAN listener LISTENER_SCAN2 is running on node stu202

SCAN Listener LISTENER_SCAN3 is enabled

SCAN listener LISTENER_SCAN3 is running on node stu202

 

####测试循环语句

for /L %%G in (1,1,200) do start /b sqlplus scott/oracle@racscan

###配置客户端tnsname.ora

RACSCAN =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = stu02-scan.szsckj.com)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = regan)

    )

  )

 

SELECT s.inst_id,count(*)

FROM GV$SESSION s

WHERE s.USERNAME != 'SYS' AND s.username IS NOT NULL

GROUP BY s.inst_id;

   INST_ID   COUNT(*)

---------- ----------

         1         50

         2         50

###这里测试11gR2 11.2.0.310gR2 10.2.0.1的客户端使用上面的配置都可以实现loadbalance.

3.2failover

基本配置如下,需要在tnsname.ora文件中附加其他选项

RACSCAN =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = stu02-scan.szsckj.com)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = regan)

      (FAILOVER_MODE =

        (TYPE = SELECT)

        (METHOD = BASIC)

        (RETRIES = 180)

        (DELAY = 5)

      )

    )

  )

###这里测试11gR2 11.2.0.310gR2 10.2.0.1的客户端使用上面的配置都可以实现failover,和官方文档所说的有出入,望了解SCAN IP工作原理的人指导。

 

2.jpg

1.jpg

3.jpg

4.jpg

5.jpg

6.jpg

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26169542/viewspace-772265/,如需转载,请注明出处,否则将追究法律责任。

上一篇: ORACLE oradebug
请登录后发表评论 登录
全部评论

注册时间:2013-07-02

  • 博文量
    31
  • 访问量
    116876