更改VIP 地址
1. 确定用于支持VIP 的接口:
#ifconfig -a [root@jyrac2 ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:0C:29:69:BC:16 inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe69:bc16/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:60675 errors:0 dropped:0 overruns:0 frame.:0 TX packets:174445 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:37386695 (35.6 MiB) TX bytes:114727056 (109.4 MiB) Interrupt:185 Base address:0x1480 eth0:1 Link encap:Ethernet HWaddr 00:0C:29:69:BC:16 inet addr:192.168.1.206 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:185 Base address:0x1480 eth1 Link encap:Ethernet HWaddr 00:0C:29:69:BC:20 inet addr:192.168.1.205 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe69:bc20/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:102825 errors:0 dropped:0 overruns:0 frame.:0 TX packets:141 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:62754558 (59.8 MiB) TX bytes:12364 (12.0 KiB) Interrupt:193 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:57831 errors:0 dropped:0 overruns:0 frame.:0 TX packets:57831 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:13053456 (12.4 MiB) TX bytes:13053456 (12.4 MiB) sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame.:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
2. 停止依赖VIP 的所有资源:
$ srvctl stop instance -d DB -i DB1 $ srvctl stop asm -n node1 $ srvctl stop nodeapps -n node1 [oracle@jyrac2 crs]$ cd /u01/app/oracle/product/10.2.0/crs/bin [oracle@jyrac2 bin]$ ./srvctl stop instance -d jyrac -i jyrac2 [oracle@jyrac2 bin]$ ./srvctl stop asm -n jyrac2 [oracle@jyrac2 bin]$ ./srvctl stop nodeapps -n jyrac2
3. 验证VIP 不再处于运行状态:
$ ifconfig -a [ + $ crs_stat [root@jyrac2 ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:0C:29:69:BC:16 inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe69:bc16/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:63053 errors:0 dropped:0 overruns:0 frame.:0 TX packets:183453 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38187756 (36.4 MiB) TX bytes:119829467 (114.2 MiB) Interrupt:185 Base address:0x1480 eth1 Link encap:Ethernet HWaddr 00:0C:29:69:BC:20 inet addr:192.168.1.205 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe69:bc20/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:111483 errors:0 dropped:0 overruns:0 frame.:0 TX packets:150 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:69802524 (66.5 MiB) TX bytes:12742 (12.4 KiB) Interrupt:193 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:60931 errors:0 dropped:0 overruns:0 frame.:0 TX packets:60931 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:13708077 (13.0 MiB) TX bytes:13708077 (13.0 MiB) sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame.:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) You have new mail in /var/spool/mail/root [root@jyrac2 ~]# [oracle@jyrac1 bin]$ ./crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.jyrac.db application ONLINE ONLINE jyrac1 ora....c1.inst application ONLINE ONLINE jyrac1 ora....c2.inst application OFFLINE OFFLINE ora....SM1.asm application ONLINE ONLINE jyrac1 ora....C1.lsnr application ONLINE ONLINE jyrac1 ora.jyrac1.gsd application ONLINE ONLINE jyrac1 ora.jyrac1.ons application ONLINE ONLINE jyrac1 ora.jyrac1.vip application ONLINE ONLINE jyrac1 ora....SM2.asm application OFFLINE OFFLINE ora....C2.lsnr application OFFLINE OFFLINE ora.jyrac2.gsd application OFFLINE OFFLINE ora.jyrac2.ons application OFFLINE OFFLINE ora.jyrac2.vip application OFFLINE OFFLINE [oracle@jyrac1 bin]$
从上面的输出可以看出实例jyrac2已经停止运行节点jyrac2的vip已经停止了
4. 更改/etc/hosts 中的IP 和DNS。
对所有节点进行修改将jyrac2节点的vip从192.168.1.206修改为192.168.1.216
[root@jyrac2 ~]# vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 jyrac2 localhost.localdomain localhost 192.168.1.201 jyrac1 192.168.1.204 jyrac2 192.168.1.202 jyrac1-priv 192.168.1.205 jyrac2-priv 192.168.1.203 jyrac1-vip 192.168.1.216 jyrac2-vip [root@jyrac1 ~]# vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 jyrac1 localhost.localdomain localhost 192.168.1.201 jyrac1 192.168.1.204 jyrac2 192.168.1.202 jyrac1-priv 192.168.1.205 jyrac2-priv 192.168.1.203 jyrac1-vip 192.168.1.216 jyrac2-vip
5. 使用srvctl 修改VIP 地址:
修改nodeapps 并提供新的虚拟IP 地址。使用带有–A 选项的srvctl modify
nodeapps 命令。应以root 用户身份运行此命令。在本幻灯片的示例中,依次指定
了新IP 地址(192.168.1.216)、相应的网络掩码(255.255.255.0) 以及希望VIP
使用的接口(eth0)。
[root@jyrac2 ~]# cd /u01/app/oracle/product/10.2.0/crs/bin [root@jyrac2 bin]# ./srvctl modify nodeapps -n jyrac2 -A 192.168.1.216/255.255.255.0/eth0 You have new mail in /var/spool/mail/root [root@jyrac2 bin]#
6. 启动nodeapps 及依赖它的所有资源:
# srvctl start nodeapps -n node1 [oracle@jyrac2 bin]$ ./srvctl start nodeapps -n jyrac2 [oracle@jyrac2 bin]$ ./srvctl start asm -n jyrac2 [oracle@jyrac2 bin]$ ./srvctl start instance -d jyrac -i jyrac2
7. 对集群中的所有节点重复上述步骤。由于srvctl 是集群范围的管理工具,因此可以
与第一个节点保持连接。
注:如果只更改了IP 地址,并且listener.ora、tnsnames.ora 和初始化参数文件使
用的是虚拟主机名,则无需对这些文件进行更改。如果同时更改了节点的虚拟主机名和
VIP 地址,则需要用新的虚拟主机名修改这些文件。对于listener.ora 文件,可以使
用netca 来删除旧监听程序并创建一个新监听程序。此外,还需要对连接到旧虚拟主机名
的所有客户机的tnsnames.ora 文件进行更改。