今天小麦苗给大家分享的是RAC 增加SCAN IP。
对新配置的oracle RAC环境增配2个SCAN IP地址,192.168.59.175以及192.168.59.176。
1.1.1.1 配置前信息
默认情况下配置RA 只有1个scan IP,1个 scan listener。
查看scan的配置信息
[root@raclhr-11gR2-N1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#Public IP
192.168.59.170 raclhr-11gR2-N1
192.168.59.171 raclhr-11gR2-N2
#Private IP
192.168.2.110 raclhr-11gR2-N1-priv
192.168.2.111 raclhr-11gR2-N2-priv
#Virtual IP
192.168.59.172 raclhr-11gR2-N1-vip
192.168.59.173 raclhr-11gR2-N2-vip
#Scan IP
192.168.59.174 raclhr-11gR2-scan
[root@raclhr-11gR2-N1 ~]# srvctl config scan
SCAN name: raclhr-11gR2-scan, Network: 1/192.168.59.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /raclhr-11gR2-scan/192.168.59.174
查看scan的状态以及scan ip所处节点
[root@raclhr-11gR2-N1 ~]# srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node raclhr-11gr2-n2
[root@raclhr-11gR2-N1 ~]#
查看scan listener
[root@raclhr-11gR2-N1 ~]# srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
[root@raclhr-11gR2-N1 ~]#
1.1.1.2 修改rac所有节点的/etc/hosts信息
[root@raclhr-11gR2-N1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#Public IP
192.168.59.170 raclhr-11gR2-N1
192.168.59.171 raclhr-11gR2-N2
#Private IP
192.168.2.110 raclhr-11gR2-N1-priv
192.168.2.111 raclhr-11gR2-N2-priv
#Virtual IP
192.168.59.172 raclhr-11gR2-N1-vip
192.168.59.173 raclhr-11gR2-N2-vip
#Scan IP
192.168.59.174 raclhr-11gR2-scan
192.168.59.175 raclhr-11gR2-scan ----->>>>新增的SCAN IP
192.168.59.176 raclhr-11gR2-scan ----->>>>新增的SCAN IP
1.1.1.3 停止scan 监听,注意先停监听才能停scan
srvctl stop scan_listener
srvctl stop scan
srvctl status scan_listener
srvctl status scan
1.1.1.4 配置scan,注意需要用root权限执行
修改scan信息,-n 后面接 hosts中的san ip 网络名:
srvctl modify scan -n raclhr-11gR2-scan
[root@raclhr-11gR2-N1 ~]# srvctl modify scan -h
Modifies the SCAN name.
Usage: srvctl modify scan -n
-n Domain name qualified SCAN name
-h Print usage
[root@raclhr-11gR2-N1 ~]#
[root@raclhr-11gR2-N1 ~]# srvctl modify scan -n raclhr-11gR2-scan
添加scanIP的监听,若不执行该命令,将只有一个listener_scan1监听,执行后将根据scan ip数自动增加listener_scan2,listener_scan3.
srvctl modify scan_listener -u
[root@raclhr-11gR2-N1 ~]# srvctl modify scan_listener -h
Modifies the SCAN listeners so that the number of SCAN listeners is the same as the number of SCAN VIPs or modifies the SCAN listener endpoints.
Usage: srvctl modify scan_listener {-u|-p [TCP:][/IPC:][/NMP:][/TCPS:] [/SDP:]}
-u Update SCAN listeners to match the number of SCAN VIPs
-p [TCP:][/IPC:][/NMP:][/TCPS:] [/SDP:] SCAN Listener endpoints
-h Print usage
[root@raclhr-11gR2-N1 ~]# srvctl modify scan_listener -u
[root@raclhr-11gR2-N1 ~]#
[root@raclhr-11gR2-N1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
........
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 OFFLINE OFFLINE
ora.LISTENER_SCAN2.lsnr
1 OFFLINE OFFLINE
ora.LISTENER_SCAN3.lsnr
1 OFFLINE OFFLINE
ora.cvu
1 ONLINE ONLINE raclhr-11gr2-n1
ora.lhrrac1.db
1 ONLINE ONLINE raclhr-11gr2-n1 Open
2 ONLINE ONLINE raclhr-11gr2-n2 Open
ora.oc4j
1 ONLINE ONLINE raclhr-11gr2-n1
ora.raclhr-11gr2-n1.vip
1 ONLINE ONLINE raclhr-11gr2-n1
ora.raclhr-11gr2-n2.vip
1 ONLINE ONLINE raclhr-11gr2-n2
ora.scan1.vip
1 OFFLINE OFFLINE
ora.scan2.vip
1 OFFLINE OFFLINE
ora.scan3.vip
1 OFFLINE OFFLINE
1.1.1.5 启动scan
srvctl start scan
srvctl start scan_listener
srvctl status scan
srvctl status scan_listener
srvctl config scan
[root@raclhr-11gR2-N1 ~]# srvctl start scan
[root@raclhr-11gR2-N1 ~]# srvctl start scan_listener
[root@raclhr-11gR2-N1 ~]# srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node raclhr-11gr2-n2
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node raclhr-11gr2-n1
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node raclhr-11gr2-n1
[root@raclhr-11gR2-N1 ~]# srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node raclhr-11gr2-n2
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node raclhr-11gr2-n1
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node raclhr-11gr2-n1
[root@raclhr-11gR2-N1 ~]#
[root@raclhr-11gR2-N1 ~]# srvctl config scan
SCAN name: raclhr-11gR2-scan, Network: 1/192.168.59.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /raclhr-11gR2-scan/192.168.59.174
SCAN VIP name: scan2, IP: /raclhr-11gR2-scan/192.168.59.175
SCAN VIP name: scan3, IP: /raclhr-11gR2-scan/192.168.59.176
[root@raclhr-11gR2-N1 ~]#
1.1.1.6 查看SCAN1和SCAN2的内容
重启集群环境后,可以看到如下内容:
[root@raclhr-11gR2-N1 admin]# lsnrctl status listener_scan3
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-JUN-2018 15:24:13
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN3
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 05-JUN-2018 15:18:55
Uptime 0 days 0 hr. 5 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/raclhr-11gR2-N1/listener_scan3/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.176)(PORT=1521)))
Services Summary...
Service "+ASM" has 2 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "lhrrac1" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
Service "lhrrac1XDB" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
Service "lhrxxt" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
The command completed successfully
[root@raclhr-11gR2-N1 admin]# lsnrctl status listener_scan2
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-JUN-2018 15:24:16
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN2
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 05-JUN-2018 15:18:55
Uptime 0 days 0 hr. 5 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/raclhr-11gR2-N1/listener_scan2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.175)(PORT=1521)))
Services Summary...
Service "+ASM" has 2 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "lhrrac1" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
Service "lhrrac1XDB" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
Service "lhrxxt" has 2 instance(s).
Instance "lhrrac11", status READY, has 1 handler(s) for this service...
Instance "lhrrac12", status READY, has 1 handler(s) for this service...
The command completed successfully
[root@raclhr-11gR2-N1 admin]#