首页 » ORACLE » 修改11g r2 RAC SCAN IP

修改11g r2 RAC SCAN IP

SCAN – Single Client Access Name

SCAN简化了客户端连接的配置,只需指定SCAN Name在客户端的tnsnames.ora,不需要知道每个节点的vip就可以实现负载均衡
每个节点上的pmon会经常的发送本节点的负载情况到scan listener,因些scan listener也了解每个节点的负载,每个实例都会注册scan listener,scan listener会根据负载分配新的请求到负载较闲的instance上
到11gr2版rac中oracle instance 用local_listener 参数指向本地vip, e.g. (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.168.192)(PORT=1521))))
用remote_listener 参数指向scan listener name 和port, e.g. rac-scan.anbob.com:1521

如果只有3个scan ip 并且有多于3个节点时,因为所有节点都会有remote_listener 注册scan listener,甚至会把scan ip寄存在前三个节点上,所以还是可以照顾到集群中的所有节点。

如果安装时通过DNS配置配置了SCAN,后期想修改SCAN NAME或SCAN IP 也是很方便的,无需重启CRS和INSTANCE,只需要在修改过dns配置以后通过SRVCTL手动更新一下

测试一下修改scan ip从原来的168.201/202/203 改为168.200/201/202

1,Check scan and scan_listener current status
[root@znode1 bin]# $OCR_HOME/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node znode1
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node znode2
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node znode2

[root@znode1 bin]# $OCR_HOME/bin/srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node znode1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node znode2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node znode2

[root@znode1 bin]# $OCR_HOME/bin/srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521

[root@znode1 bin]# $OCR_HOME/bin/srvctl config scan
SCAN name: rac-scan.anbob.com, Network: 1/192.168.168.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan.anbob.com/192.168.168.202
SCAN VIP name: scan2, IP: /rac-scan.anbob.com/192.168.168.203
SCAN VIP name: scan3, IP: /rac-scan.anbob.com/192.168.168.201

2,stop scan and scan_listener
[grid@znode1 ~]$ srvctl stop scan_listener
[grid@znode1 ~]$ srvctl stop scan
[grid@znode1 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is not running
SCAN VIP scan2 is enabled
SCAN VIP scan2 is not running
SCAN VIP scan3 is enabled
SCAN VIP scan3 is not running
[grid@znode1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is not running
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is not running
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is not running

3,modify DNS configuration

[root@znode1 named]# nslookup rac-scan.anbob.com
Server:         192.168.168.191
Address:        192.168.168.191#53

Name:   rac-scan.anbob.com
Address: 192.168.168.201
Name:   rac-scan.anbob.com
Address: 192.168.168.202
Name:   rac-scan.anbob.com
Address: 192.168.168.203

[root@znode1 named]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@znode1 named]# nslookup rac-scan.anbob.com
Server:         192.168.168.191
Address:        192.168.168.191#53

Name:   rac-scan.anbob.com
Address: 192.168.168.200
Name:   rac-scan.anbob.com
Address: 192.168.168.201
Name:   rac-scan.anbob.com
Address: 192.168.168.202

4,check scan config again
[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl config scan
SCAN name: rac-scan.anbob.com, Network: 1/192.168.168.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan.anbob.com/192.168.168.202
SCAN VIP name: scan2, IP: /rac-scan.anbob.com/192.168.168.203
SCAN VIP name: scan3, IP: /rac-scan.anbob.com/192.168.168.201

5,modify scan and scan_listener
[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n rac-scan.anbob.com

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl config scan
SCAN name: rac-scan.anbob.com, Network: 1/192.168.168.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan.anbob.com/192.168.168.202
SCAN VIP name: scan2, IP: /rac-scan.anbob.com/192.168.168.200
SCAN VIP name: scan3, IP: /rac-scan.anbob.com/192.168.168.201

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl modify scan_listener -u

6,start scan and scan_listener

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl start scan

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl start scan_listener

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node znode1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node znode2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node znode1

[root@znode1 grid]# /u01/app/11.2.0/grid/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node znode1
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node znode2
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node znode1

[root@znode1 grid]# ping 192.168.168.200
PING 192.168.168.200 (192.168.168.200) 56(84) bytes of data.
64 bytes from 192.168.168.200: icmp_seq=1 ttl=64 time=1.53 ms
64 bytes from 192.168.168.200: icmp_seq=2 ttl=64 time=0.174 ms

[root@znode2 bin]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:D6:B6:49
          inet addr:192.168.168.193  Bcast:192.168.168.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1984371 errors:116452 dropped:0 overruns:0 frame:0
          TX packets:319186 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:171413136 (163.4 MiB)  TX bytes:53482841 (51.0 MiB)
          Interrupt:19 Base address:0x2c24 

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:D6:B6:49
          inet addr:192.168.168.200  Bcast:192.168.168.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:19 Base address:0x2c24 

eth0:5    Link encap:Ethernet  HWaddr 00:0C:29:D6:B6:49
          inet addr:192.168.168.194  Bcast:192.168.168.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:19 Base address:0x2c24
...
打赏

对不起,这篇文章暂时关闭评论。