在一套数据库系统搭建之前,本应该认真规划存储、网络、主机名等基本配置信息的,一旦确定下来,就不要轻易去改诸如hostname、IP地址等配置信息。除非不得已或规划有问题的前提下,我们需要不得已而为之。这不,自己就犯下了这个错误:之前在OEL 5.5 X86_64位系统上搭建了一套11gR2 的双节点RAC做测试用,用完之后,就连两台服务器都shutdown。后来,又搭建了一套新的OEL 5.5 X86_64+11gR2 RAC的开发系统,由于自己的疏忽,这套开发用的RAC机器的私有IP(private IP)同原来的那套测试RAC私有IP地址冲突,现在想用原来的那套RAC问题就来了,根本就无法使用,因为测试RAC根本启不来!!!自己搬石头砸自己脚啊,不过呢,好在自己给这套开发的RAC系统搭建了一套物理dataguard,于是乎,先将开发RAC系统作一个switchover先切换至物理备库,然后停开发RAC系统,启动测试RAC系统,修改测试RAC系统的私有IP,这样,改完Private IP之后,两套RAC就都可以正常使用了。绕弯了,呵呵,谁让自己前期没有规划好了,算是给自己一个教训。
本文就简单记录一下在OEL 5.5 X86_64+11gR2 RAC系统下如何修改私有IP?
1 修改Private IP前,服务器IP配置信息:
hostname | type | IP Address | Domain Name | Interface |
---|---|---|---|---|
rac1 | public IP | 172.16.0.191 | rac1.localdomain | eth0 |
rac1 | private IP | 192.168.93.1 | rac1-priv.localdomain | eth1 |
rac1 | virtual IP | 172.16.0.193 | rac1-vip.localdomain | eth0:1 |
rac2 | public IP | 172.16.0.192 | rac2.localdomain | eth0 |
rac2 | private IP | 192.168.93.2 | rac2-priv.localdomain | eth1 |
rac2 | virtual IP | 172.16.0.194 | rac2-vip.localdomain | eth0:1 |
SCAN | SCAN IP | 172.16.0.203 | rac-scan.localdomain | rac-scan |
欲将Private IP修改为下述目标配置:
hostname | type | IP Address | Domain Name | Interface |
---|---|---|---|---|
rac1 | public IP | 172.16.0.191 | rac1.localdomain | eth0 |
rac1 | private IP | 192.168.94.1 | rac1-priv.localdomain | eth1 |
rac1 | virtual IP | 172.16.0.193 | rac1-vip.localdomain | eth0:1 |
rac2 | public IP | 172.16.0.192 | rac2.localdomain | eth0 |
rac2 | private IP | 192.168.94.2 | rac2-priv.localdomain | eth1 |
rac2 | virtual IP | 172.16.0.194 | rac2-vip.localdomain | eth0:1 |
SCAN | SCAN IP | 172.16.0.203 | rac-scan.localdomain | rac-scan |
2 修改Private IP前,节点1服务器/etc/hosts配置文件内容:
[root@rac1 ~]# uname -rm 2.6.18-194.el5xen x86_64 [root@rac1 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. #127.0.0.1 localhost.localdomain localhost 127.0.0.1 localhost ::1 localhost6.localdomain6 localhost6 #172.16.0.191 rac1.localdomain rac1 172.16.0.191 rac1.localdomain rac1 172.16.0.193 rac1-vip.localdomain rac1-vip 192.168.93.1 rac1-priv.localdomain rac1-priv 172.16.0.192 rac2.localdomain rac2 172.16.0.194 rac2-vip.localdomain rac2-vip 192.168.93.2 rac2-priv.localdomain rac2-priv 172.16.0.203 rac-scan.localdomain rac-scan [root@rac1 ~]#
3 修改Private IP前,服务器RAC集群服务信息:
[root@rac1 ~]# su - grid rac1-> crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATADG.dg ora....up.type ONLINE ONLINE rac1 ora.GRIDDG.dg ora....up.type ONLINE ONLINE rac1 ora....ER.lsnr ora....er.type ONLINE ONLINE rac1 ora....N1.lsnr ora....er.type ONLINE ONLINE rac2 ora.asm ora.asm.type ONLINE ONLINE rac1 ora.devdb.db ora....se.type ONLINE ONLINE rac1 ora.eons ora.eons.type ONLINE ONLINE rac1 ora.gsd ora.gsd.type ONLINE ONLINE rac1 ora....network ora....rk.type ONLINE ONLINE rac1 ora.oc4j ora.oc4j.type ONLINE ONLINE rac2 ora.ons ora.ons.type ONLINE ONLINE rac1 ora....SM1.asm application ONLINE ONLINE rac1 ora....C1.lsnr application ONLINE ONLINE rac1 ora.rac1.gsd application ONLINE ONLINE rac1 ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip ora....t1.type ONLINE ONLINE rac1 ora....SM2.asm application ONLINE ONLINE rac2 ora....C2.lsnr application ONLINE ONLINE rac2 ora.rac2.gsd application ONLINE ONLINE rac2 ora.rac2.ons application ONLINE ONLINE rac2 ora.rac2.vip ora....t1.type ONLINE ONLINE rac2 ora....ry.acfs ora....fs.type ONLINE ONLINE rac1 ora.scan1.vip ora....ip.type ONLINE ONLINE rac2 rac1->
4 用oifcfg开始修改Private IP:
修改Private IP之前,grid用户用olsnodes确认节点状态:
rac1-> olsnodes -n -s rac1 1 Active rac2 2 Active rac1-> oifcfg getif eth0 172.16.0.0 global public eth1 192.168.93.0 global cluster_interconnect rac1->
修改Private IP,grid用户用oifcfg命令修改,修改之后,并删掉之前的那条配置信息:
rac1-> oifcfg setif -global eth1/192.168.94.0:cluster_interconnect rac1-> oifcfg getif eth0 172.16.0.0 global public eth1 192.168.93.0 global cluster_interconnect eth1 192.168.94.0 global cluster_interconnect rac1-> oifcfg delif -global eth1/192.168.93.0 rac1-> oifcfg getif eth0 172.16.0.0 global public eth1 192.168.94.0 global cluster_interconnect rac1->
修改Private IP之后,记得确认:
rac1-> oifcfg getif eth0 172.16.0.0 global public eth1 192.168.94.0 global cluster_interconnect rac1->
5 关闭数据库、集群服务:
rac1-> srvctl stop database -d devdb
root用户停集群服务:
[root@rac1 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster -all CRS-2673: Attempting to stop 'ora.crsd' on 'rac2' CRS-2673: Attempting to stop 'ora.crsd' on 'rac1' CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac2' CRS-2673: Attempting to stop 'ora.oc4j' on 'rac2' CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac2' CRS-2673: Attempting to stop 'ora.GRIDDG.dg' on 'rac2' CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac2' CRS-2673: Attempting to stop 'ora.DATADG.dg' on 'rac2' CRS-2673: Attempting to stop 'ora.gsd' on 'rac2' CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac2' CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1' CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1' CRS-2673: Attempting to stop 'ora.GRIDDG.dg' on 'rac1' CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1' CRS-2673: Attempting to stop 'ora.DATADG.dg' on 'rac1' CRS-2673: Attempting to stop 'ora.gsd' on 'rac1' CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac2' CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac2' CRS-2677: Stop of 'ora.rac2.vip' on 'rac2' succeeded CRS-2677: Stop of 'ora.scan1.vip' on 'rac2' succeeded CRS-2677: Stop of 'ora.gsd' on 'rac2' succeeded CRS-2677: Stop of 'ora.registry.acfs' on 'rac2' succeeded CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1' CRS-2677: Stop of 'ora.gsd' on 'rac1' succeeded CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded CRS-2677: Stop of 'ora.registry.acfs' on 'rac1' succeeded CRS-2677: Stop of 'ora.GRIDDG.dg' on 'rac2' succeeded CRS-2677: Stop of 'ora.GRIDDG.dg' on 'rac1' succeeded CRS-2677: Stop of 'ora.DATADG.dg' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.asm' on 'rac2' CRS-2677: Stop of 'ora.DATADG.dg' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.asm' on 'rac1' CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.eons' on 'rac1' CRS-2673: Attempting to stop 'ora.ons' on 'rac1' CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1' CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded CRS-2677: Stop of 'ora.oc4j' on 'rac2' succeeded CRS-2677: Stop of 'ora.eons' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.ons' on 'rac2' CRS-2673: Attempting to stop 'ora.eons' on 'rac2' CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed CRS-2677: Stop of 'ora.ons' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.net1.network' on 'rac2' CRS-2677: Stop of 'ora.net1.network' on 'rac2' succeeded CRS-2677: Stop of 'ora.eons' on 'rac2' succeeded CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac2' has completed CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac1' CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1' CRS-2673: Attempting to stop 'ora.evmd' on 'rac1' CRS-2673: Attempting to stop 'ora.asm' on 'rac1' CRS-2677: Stop of 'ora.cssdmonitor' on 'rac1' succeeded CRS-2677: Stop of 'ora.crsd' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac2' CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2' CRS-2673: Attempting to stop 'ora.evmd' on 'rac2' CRS-2673: Attempting to stop 'ora.asm' on 'rac2' CRS-2677: Stop of 'ora.cssdmonitor' on 'rac2' succeeded CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.cssd' on 'rac1' CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.cssd' on 'rac2' CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded CRS-2673: Attempting to stop 'ora.diskmon' on 'rac1' CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded CRS-2673: Attempting to stop 'ora.diskmon' on 'rac2' CRS-2677: Stop of 'ora.diskmon' on 'rac1' succeeded CRS-2677: Stop of 'ora.diskmon' on 'rac2' succeeded [root@rac1 ~]#
6 修改双节点/etc/hosts配置文件后:
[root@rac1 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. #127.0.0.1 localhost.localdomain localhost 127.0.0.1 localhost ::1 localhost6.localdomain6 localhost6 172.16.0.191 rac1.localdomain rac1 172.16.0.193 rac1-vip.localdomain rac1-vip 192.168.94.1 rac1-priv.localdomain rac1-priv 172.16.0.192 rac2.localdomain rac2 172.16.0.194 rac2-vip.localdomain rac2-vip 192.168.94.2 rac2-priv.localdomain rac2-priv 172.16.0.203 rac-scan.localdomain rac-scan [root@rac1 ~]#
7 修改双节点Private IP:
记得一定要修改双节点/etc/sysconfig/network-scripts/ifcfg-eth1配置文件,因为,不修改的话,下次重启服务器后,Private IP又变成了旧的Private IP,因为ifconfig 配置的IP地址只是临时生效,这步骤切记!
[root@rac1 ~]# ifconfig eth1 192.168.94.1 netmask 255.255.255.0
修改前节点1 /etc/sysconfig/network-scripts/ifcfg-eth1:
[root@rac1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) DEVICE=eth1 BOOTPROTO=none BROADCAST=192.168.93.255 HWADDR=00:0C:29:E8:15:5E IPADDR=192.168.93.1 NETMASK=255.255.255.0 NETWORK=192.168.93.0 ONBOOT=yes TYPE=Ethernet [root@rac1 ~]#
修改后节点1 /etc/sysconfig/network-scripts/ifcfg-eth1:
[root@rac1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) DEVICE=eth1 BOOTPROTO=none BROADCAST=192.168.94.255 HWADDR=00:0C:29:E8:15:5E IPADDR=192.168.94.1 NETMASK=255.255.255.0 NETWORK=192.168.94.0 ONBOOT=yes TYPE=Ethernet [root@rac1 ~]#
节点2如法炮制,不再赘述。
8 启动集群服务,启动数据库。至此,完成在OEL 5.5 X86_64+11gR2 RAC系统下修改私有IP。