CentOS 5中改造RAC的private ip實現雙網路卡繫結

cnhtm發表於2009-12-04

CentOS 5.4上安裝的10G RAC,原來的心跳是單網路卡的,需要修改為雙網路卡。


原來的環境如下:
eth0 192.168.2.x public ip
eth1 192.168.0.x private ip


增加了一塊網路卡,介面名為eth2,需要將eth1與新增加的eth2實現繫結,並使用原來的IP。

修改過程主要涉及到兩個問題:
1、實現雙網路卡繫結
2、修改RAC Interconnect interface name


實現過程如下:

[@more@]

1、實現CentOS5的雙網路卡繫結

在每個節點上以root使用者身份進入/etc/sysconfig/network-scripts/目錄,修改ifcfg-eth1、ifcfg-eth2檔案,然後建立ifcfg-bond0檔案,各個檔案內容如下:

ifcfg-eth1

[root@rac2 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none



ifcfg-eth2
[root@rac2 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none



ifcfg-bond0
需要注意的地方是,在CentOS5中,與CentOS4實現繫結的方式不同,需要將繫結引數(下面標記為綠色的一行)寫入ifcfg-bond0檔案中,而不是寫入/etc/modprobe.conf檔案中
[root@rac2 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
IPADDR=192.168.0.102
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
BONDING_OPTS="mode=0 miimon=100"


修改/etc/modprobe.conf檔案,在檔案最後增加一行,內容為"alias bond0 bonding",與CentOS4不同的是,這裡不增加繫結引數的內容,因為繫結引數的內容已經配置在上面的ifcfg-bond0檔案中配置了

[root@rac2 network-scripts]# cat /etc/modprobe.conf
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
options snd-ens1371 index=0
remove snd-ens1371 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1371

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
# Added by VMware Tools
install pciehp /sbin/modprobe -q --ignore-install acpiphp; /bin/true
install pcnet32 (/sbin/modprobe -q --ignore-install vmxnet || /sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS);/bin/true
alias eth0 vmxnet
alias eth1 vmxnet
alias eth2 vmxnet

alias bond0 bonding


修改/etc/rc.d/rc.local檔案,在檔案中增加一行,內容為"ifenslave bond0 eth1 eth2"

[root@rac2 network-scripts]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

ifenslave bond0 eth1 eth2

chown oracle:oinstall /dev/raw/raw1
chown oracle:oinstall /dev/raw/raw2
chown oracle:oinstall /dev/raw/raw3
chown oracle:oinstall /dev/raw/raw4
chown oracle:oinstall /dev/raw/raw5
chmod 600 /dev/raw/raw1
chmod 600 /dev/raw/raw2
chmod 600 /dev/raw/raw3
chmod 600 /dev/raw/raw4
chmod 600 /dev/raw/raw5

不需要重啟主機,使用如下兩個命令使繫結生效:

[root@rac2 network-scripts]# ldconfig

[root@rac2 ~]# /etc/init.d/network restart
Shutting down interface bond0: [ OK ]
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Bringing up interface eth0: [ OK ]

使用如下命令檢查繫結情況

[root@rac2 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:a4:8a:8d

Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:a4:8a:97




2、修改RAC Interconnect interface name

修改Interconnect interface name或ip主要使用oifcfg命令,這個命令需要保持crs開啟狀態。
修改的操作只需要在一個節點上完成。

檢查crs狀態

[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 application 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 application ONLINE ONLINE rac2
[root@rac1 ~]#

檢查CRS的public ip和private ip配置情況

[root@rac1 ~]# oifcfg getif
eth0 192.168.2.0 global public
eth1 192.168.0.0 global cluster_interconnect
[root@rac1 ~]#

這裡要修改的是cluster_interconnect的介面名,由eth1修改為bond0
修改的過程很簡單,首先刪除,然後再設定

[root@rac1 ~]# oifcfg delif -global eth1
[root@rac1 ~]#
[root@rac1 ~]# oifcfg setif -global bond0/192.168.0.0:cluster_interconnect
[root@rac1 ~]#

修改完成之後,檢查修改是否生效

[root@rac1 ~]# oifcfg getif
eth0 192.168.2.0 global public
bond0 192.168.0.0 global cluster_interconnect
[root@rac1 ~]#
[root@rac1 ~]# oifcfg iflist
eth0 192.168.2.0
bond0 192.168.0.0
[root@rac1 ~]#

在兩個節點上重啟crs

[root@rac1 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 ~]# crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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 application 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 application ONLINE ONLINE rac2

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22049049/viewspace-1029339/,如需轉載,請註明出處,否則將追究法律責任。

相關文章