通过CRS和多个网卡,实现在PUBLIC网卡DOWN掉后,切换到STANDBY网卡,而不是另一个节点的功能
--先需要通过oifcfg配置网卡信息,因为虚拟机的原因,我这里2个网卡配置在同一个网段。
[oracle@westzq3 ~]$ oifcfg getif
eth0 83.16.16.0 global public
eht2 83.16.16.0 global public
eth1 192.168.123.0 global cluster_interconnect
--看看以前VIP的配置
[oracle@westzq3 ~]$ /u01/app/oracle/product/crs/bin/srvctl config nodeapps -n westzq3 -a
VIP exists.: /westzq3-vip/83.16.16.103/255.255.255.0/eth0:eth2
[oracle@westzq3 ~]$ /u01/app/oracle/product/crs/bin/srvctl config nodeapps -n westzq4 -a
VIP exists.: /westzq4-vip/83.16.16.104/255.255.255.0/eth0:eth2
--重新配置VIP,定义其能在2个网卡上切换
[root@westzq3 ~]# /u01/app/oracle/product/crs/bin/srvctl modify nodeapps -n westzq3 -A 83.16.16.103/255.255.255.0/"eth0|eth2"
[root@westzq3 ~]# /u01/app/oracle/product/crs/bin/srvctl modify nodeapps -n westzq4 -A 83.16.16.104/255.255.255.0/"eth0|eth2"
--RAC的PUBLIC网络要求定义默认的路由,为了切换正常,我定义了2个默认路由。如果某个网卡的网络不是默认路由的话,那么切换会失败
[root@westzq3 ~]# route del -net 0.0.0.0
[root@westzq3 ~]# route add -net 0.0.0.0 gw 83.16.16.1 eth0
[root@westzq3 ~]# route add -net 0.0.0.0 gw 83.16.16.1 eth2
[root@westzq3 ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
83.16.16.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
83.16.16.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.123.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
0.0.0.0 83.16.16.1 0.0.0.0 UG 0 0 0 eth2
0.0.0.0 83.16.16.1 0.0.0.0 UG 0 0 0 eth0
--------------------------------------------------------------------------------
测试:
[root@westzq3 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:00:01:03
inet addr:83.16.16.13 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:103/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:143 errors:0 dropped:0 overruns:0 frame.:0
TX packets:151 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11631 (11.3 KiB) TX bytes:9726 (9.4 KiB)
Interrupt:10 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:50:56:00:01:03
inet addr:83.16.16.103 Bcast:83.16.16.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:10 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:50:56:00:02:03
inet addr:192.168.123.13 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19487 errors:0 dropped:0 overruns:0 frame.:0
TX packets:22806 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9784512 (9.3 MiB) TX bytes:17153748 (16.3 MiB)
Interrupt:5 Base address:0x1800
eth2 Link encap:Ethernet HWaddr 00:0C:29:C2:03:41
inet addr:83.16.16.23 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:341/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:148 errors:0 dropped:0 overruns:0 frame.:0
TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10623 (10.3 KiB) TX bytes:2682 (2.6 KiB)
Interrupt:9 Base address:0x1880
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:11117 errors:0 dropped:0 overruns:0 frame.:0
TX packets:11117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3449878 (3.2 MiB) TX bytes:3449878 (3.2 MiB)
[root@westzq3 ~]# ifconfig eth0 down
[root@westzq3 ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:50:56:00:02:03
inet addr:192.168.123.13 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20096 errors:0 dropped:0 overruns:0 frame.:0
TX packets:23531 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9845637 (9.3 MiB) TX bytes:17280642 (16.4 MiB)
Interrupt:5 Base address:0x1800
eth2 Link encap:Ethernet HWaddr 00:0C:29:C2:03:41
inet addr:83.16.16.23 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:341/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:154 errors:0 dropped:0 overruns:0 frame.:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11319 (11.0 KiB) TX bytes:3270 (3.1 KiB)
Interrupt:9 Base address:0x1880
eth2:1 Link encap:Ethernet HWaddr 00:0C:29:C2:03:41
inet addr:83.16.16.103 Bcast:83.16.16.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:9 Base address:0x1880
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:11371 errors:0 dropped:0 overruns:0 frame.:0
TX packets:11371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3457493 (3.2 MiB) TX bytes:3457493 (3.2 MiB)
[root@westzq3 ~]# ifconfig eth2 down
[root@westzq3 ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:50:56:00:02:03
inet addr:192.168.123.13 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20907 errors:0 dropped:0 overruns:0 frame.:0
TX packets:24480 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9977841 (9.5 MiB) TX bytes:17567481 (16.7 MiB)
Interrupt:5 Base address:0x1800
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:11717 errors:0 dropped:0 overruns:0 frame.:0
TX packets:11717 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3467527 (3.3 MiB) TX bytes:3467527 (3.3 MiB)
[root@westzq4 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:00:01:04
inet addr:83.16.16.14 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:104/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:416 errors:0 dropped:0 overruns:0 frame.:0
TX packets:370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37713 (36.8 KiB) TX bytes:31444 (30.7 KiB)
Interrupt:10 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:50:56:00:01:04
inet addr:83.16.16.104 Bcast:83.16.16.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:10 Base address:0x1480
eth0:2 Link encap:Ethernet HWaddr 00:50:56:00:01:04
inet addr:83.16.16.103 Bcast:83.16.16.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:10 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:50:56:00:02:04
inet addr:192.168.123.14 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:204/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20362 errors:0 dropped:0 overruns:0 frame.:0
TX packets:16962 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16811057 (16.0 MiB) TX bytes:9690755 (9.2 MiB)
Interrupt:5 Base address:0x1800
eth2 Link encap:Ethernet HWaddr 00:0C:29:C2:03:41
inet addr:83.16.16.24 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:341/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame.:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12015 (11.7 KiB) TX bytes:1050 (1.0 KiB)
Interrupt:9 Base address:0x1880
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:12902 errors:0 dropped:0 overruns:0 frame.:0
TX packets:12902 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3628183 (3.4 MiB) TX bytes:3628183 (3.4 MiB)
[oracle@westzq3 ~]$ ./crsstat.sh
HA Resource Target State
----------- ------ -----
ora.rac.db OFFLINE OFFLINE
ora.rac.oratest.cs OFFLINE OFFLINE
ora.rac.oratest.rac1.srv OFFLINE OFFLINE
ora.rac.oratest.rac2.srv OFFLINE OFFLINE
ora.rac.rac1.inst OFFLINE OFFLINE
ora.rac.rac2.inst OFFLINE OFFLINE
ora.westzq3.ASM1.asm OFFLINE OFFLINE
ora.westzq3.LISTENER_WESTZQ3.lsnr OFFLINE OFFLINE
ora.westzq3.gsd OFFLINE OFFLINE
ora.westzq3.ons OFFLINE OFFLINE
ora.westzq3.vip ONLINE ONLINE on westzq4
ora.westzq4.ASM2.asm OFFLINE OFFLINE
ora.westzq4.LISTENER_WESTZQ4.lsnr OFFLINE OFFLINE
ora.westzq4.gsd OFFLINE OFFLINE
ora.westzq4.ons OFFLINE OFFLINE
ora.westzq4.vip ONLINE ONLINE on westzq4
[oracle@westzq3 ~]$
[root@westzq3 ~]# ifconfig eth0 up
[root@westzq3 ~]# ifconfig eth2 up
[root@westzq3 ~]# route add -net 0.0.0.0 gw 83.16.16.1 eth0
[root@westzq3 ~]# route add -net 0.0.0.0 gw 83.16.16.1 eth2
-- 这些最好能加到/u01/app/oracle/product/crs/bin/racgwrap脚本里面去,LINUX下网卡重启,添加的路由就不见了,怎么搞持久路由不清楚
[oracle@westzq3 ~]$ crs_relocate ora.westzq3.vip
Attempting to stop `ora.westzq3.vip` on member `westzq4`
Stop of `ora.westzq3.vip` on member `westzq4` succeeded.
Attempting to start `ora.westzq3.vip` on member `westzq3`
Start of `ora.westzq3.vip` on member `westzq3` succeeded.
[root@westzq3 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:00:01:03
inet addr:83.16.16.13 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:103/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:154 errors:0 dropped:0 overruns:0 frame.:0
TX packets:172 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12519 (12.2 KiB) TX bytes:11144 (10.8 KiB)
Interrupt:10 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:50:56:00:01:03
inet addr:83.16.16.103 Bcast:83.16.16.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:10 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:50:56:00:02:03
inet addr:192.168.123.13 Bcast:192.168.123.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21655 errors:0 dropped:0 overruns:0 frame.:0
TX packets:25158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10107237 (9.6 MiB) TX bytes:17767378 (16.9 MiB)
Interrupt:5 Base address:0x1800
eth2 Link encap:Ethernet HWaddr 00:0C:29:C2:03:41
inet addr:83.16.16.23 Bcast:83.16.16.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec2:341/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:168 errors:0 dropped:0 overruns:0 frame.:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12428 (12.1 KiB) TX bytes:3764 (3.6 KiB)
Interrupt:9 Base address:0x1880
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:12116 errors:0 dropped:0 overruns:0 frame.:0
TX packets:12116 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3479347 (3.3 MiB) TX bytes:3479347 (3.3 MiB)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8242091/viewspace-614792/ ,如需转载,请注明出处,否则将追究法律责任。