天天看點

Oracle 11gR2 RAC 單網卡 轉 雙網卡綁定 配置步驟

一.原RAC資訊

資料庫:11.2.0.3

作業系統: Redhat 5.8

[root@rac1 ~]# cat /etc/hosts

127.0.0.1 localhost

192.168.16.200 rac1 rac1-public

192.168.0.100 rac1-priv

192.168.16.201 rac1-vip

192.168.16.202 rac2 rac2-public

192.168.0.200 rac2-priv

192.168.16.203 rac2-vip

192.168.16.207 rac-scan

每個節點的伺服器有4個網卡。 eth0對應Public IP,eth1 對應Private IP。

[root@rac1 ~]# srvctl config nodeapps

Network exists:1/192.168.16.0/255.255.255.0/eth0, type static

VIP exists:/rac1-vip/192.168.16.201/192.168.16.0/255.255.255.0/eth0, hosting node rac1

VIP exists:/rac2-vip/192.168.16.203/192.168.16.0/255.255.255.0/eth0, hosting node rac2

GSD exists

ONS exists: Local port 6100, remote port6200, EM port 2016

[root@rac1 ~]# srvctl config nodeapps -nrac1 -a

-n <node_name> option has beendeprecated.

VIP exists: /rac1-vip/192.168.16.201/192.168.16.0/255.255.255.0/eth0,hosting node rac1

[root@rac1 ~]# srvctl config nodeapps -nrac2 -a

VIP exists: /rac2-vip/192.168.16.203/192.168.16.0/255.255.255.0/eth0,hosting node rac2

[root@rac1 ~]#

二.修改RAC 配置

之前的測試是先修改雙網卡的綁定,但是一旦修改之後,RAC就不能啟動,也就不能進行修改,是以我們這裡先修改。修改完之後在該雙網卡。

2.1 備份OCR和VOTINGDISK

[root@rac1 ~]# crsctl query css votedisk

## STATE    File Universal Id                File Name Disk group

-- -----    -----------------                --------- ---------

 1.ONLINE   6be9df5e116e4fa6bfea0a06cec3a0e5(/dev/asm-diskb) [OCRVOTING]

 2.ONLINE   0935e75b0c3e4fe3bf34ec484d7a332e(/dev/asm-diskc) [OCRVOTING]

 3.ONLINE   9191596fff034f6abfcdaf3b77dbadd9(/dev/asm-diskd) [OCRVOTING]

 4.ONLINE   3ed8af5882454ffdbf1ac89b47531b96(/dev/asm-diske) [OCRVOTING]

 5.ONLINE   52cb435078424fc5bfd693bdb0e6771b(/dev/asm-diskf) [OCRVOTING]

[root@rac1 ~]# dd if=/dev/asm-diskbof=/u01/backup/voting_disk.bak

2097152+0 records in

2097152+0 records out

1073741824 bytes (1.1 GB) copied, 15.5894seconds, 68.9 MB/s

[root@rac1 ~]# ocrconfig -export/u01/backup/ocr.exp

[root@rac1 ~]# ocrconfig -showbackup

rac2    2013/02/25 20:28:57    /u01/app/grid/11.2.0/cdata/rac-cluster/backup00.ocr

rac2    2013/02/25 16:28:57    /u01/app/grid/11.2.0/cdata/rac-cluster/backup01.ocr

rac2    2013/02/25 12:28:57    /u01/app/grid/11.2.0/cdata/rac-cluster/backup02.ocr

rac1    2013/02/24 06:05:17    /u01/app/grid/11.2.0/cdata/rac-cluster/day.ocr

rac1    2013/02/19 18:18:35    /u01/app/grid/11.2.0/cdata/rac-cluster/week.ocr

2.1 修改網卡和IP資訊

2.1.1 RAC 程序資訊

[root@rac1 ~]# crs_stat -t

Name           Type           Target    State    Host       

------------------------------------------------------------

ora.DATA.dg    ora....up.type ONLINE    ONLINE   rac1       

ora.FRA.dg     ora....up.type ONLINE    ONLINE   rac1       

ora....ER.lsnr ora....er.type ONLINE    ONLINE   rac1       

ora....N1.lsnr ora....er.type ONLINE    ONLINE   rac1       

ora....TING.dg ora....up.type ONLINE    ONLINE   rac1       

ora.asm        ora.asm.type   ONLINE   ONLINE    rac1       

ora.cd.db      ora....se.type ONLINE    ONLINE   rac1       

ora.cvu        ora.cvu.type   ONLINE   ONLINE    rac1       

ora.gsd        ora.gsd.type   OFFLINE  OFFLINE              

ora....network ora....rk.type ONLINE    ONLINE   rac1       

ora.oc4j       ora.oc4j.type  ONLINE   ONLINE    rac1       

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    OFFLINE  OFFLINE              

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    OFFLINE  OFFLINE              

ora.rac2.ons   application    ONLINE   ONLINE    rac2       

ora.rac2.vip   ora....t1.type ONLINE    ONLINE   rac2       

ora....ry.acfs ora....fs.type ONLINE    OFFLINE              

ora.scan1.vip  ora....ip.type ONLINE    ONLINE   rac1       

2.1.2 檢視目前配置

[root@rac1 ~]# oifcfg getif -global

eth1 192.168.0.0  global  cluster_interconnect

eth0 192.168.16.0  global  public

2.1.3 修改PUBLIC和 Private資訊

--删除目前配置

[root@rac1 ~]# oifcfg delif -global eth0

[root@rac1 ~]# oifcfg delif -global eth1

PRIF-31: Failed to deletethe specified network interface because it is the last private interface

--這裡我們要先添加才能删除。

[root@rac1 ~]# oifcfg getif

[root@rac1 ~]# oifcfg setif -globalbond0/192.168.16.0:public

[root@rac1 ~]# oifcfg setif -globalbond1/192.168.0.0:cluster_interconnect

bond0 192.168.16.0  global  public

bond1 192.168.0.0  global  cluster_interconnect

2.1.4 修改VIP

[root@rac1 ~]# srvctl modify nodeapps -nrac1 -A 192.168.16.201/255.255.255.0/bond0

PRKO-2200 : Invalid interface specified oncommand line: bond0

--提示bond0沒有激活,先把bond0的配置資訊寫好,激活,先改我們CRS的資訊:

[root@rac1 network-scripts]# ifup bond0

--再次修改就ok:

[root@rac1 ~]# srvctl modify nodeapps -nrac2 -A 192.168.16.203/255.255.255.0/bond0

[root@raw1 bin]# ./oifcfg delif -globaleth0

[root@raw1 bin]# ./oifcfgdelif -global eth1

[root@raw1 bin]# ./oifcfg getif

2.1.5 檢查監聽等配置中的IP 資訊

因為我這裡隻是修改了一下網卡的名稱,是以不需要檢查,IP位址是一樣的。

三.雙網卡綁定配置

3.1 停止RAC

# crsctl stop crs

3.1 節點1操作

建立/etc/sysconfig/network-scripts/ifcfg-bond0檔案,内容如下:

DEVICE=bond0

BOOTPROTO=none

BROADCAST=192.168.16.255

IPADDR=192.168.16.200

NETMASK=255.255.255.0

ONBOOT=yes

TYPE=Ethernet

GATEWAY=192.168.16.254

USERCTL=no

IPV6INIT=no

PEERDNS=yes

建立/etc/sysconfig/network-scripts/ifcfg-bond1檔案,内容如下:

DEVICE=bond1

BROADCAST=192.168.0.255

IPADDR=192.168.0.100

GATEWAY=192.168.0.254

分别修改原來網卡配置檔案的資訊,删除其中的IP 位址、子網路遮罩等資訊

[root@rac1 network-scripts]# cat ifcfg-eth0

# Broadcom Corporation NetXtreme BCM5720Gigabit Ethernet PCIe

DEVICE=eth0

[root@rac1 network-scripts]# cat ifcfg-eth1

DEVICE=eth1

[root@rac1 network-scripts]# cat ifcfg-eth2

DEVICE=eth2

[root@rac1 network-scripts]# cat ifcfg-eth3

DEVICE=eth3

[root@rac1 network-scripts]#

在/etc/modprobe.conf檔案中添加如下内容:

aliasbond0 bonding

alias bond1 bonding

options bond0 miimon=100 mode=0

options bond1 miimon=100 mode=0

說明:

(1)、miimon 是鍊路監測的時間間隔機關是毫秒,miimon=100的意思就是,每100毫秒檢測網卡和交換機之間是否連通,如不通則使用另外的鍊路。

(2)、mode=0 表示負載均衡方式,兩塊網卡都工作,需要交換機作支援  

         mode=1 表示備援方式,網卡隻有一個工作,一個出問題啟用另外的

        mode=6 表示負載均衡方式,兩塊網卡都工作,不需要交換機作支援

2.2 節點2操作

IPADDR=192.168.16.202

IPADDR=192.168.0.200

[root@rac2 network-scripts]# cat ifcfg-eth0

[root@rac2 network-scripts]# cat ifcfg-eth1

[root@rac2 network-scripts]# cat ifcfg-eth2

[root@rac2 network-scripts]# cat ifcfg-eth3

[root@rac2 network-scripts]#

在/etc/modules.conf檔案中添加如下内容:

alias bond0bonding

2.3. 執行綁定

--節點1執行綁定:

[root@rac1 network-scripts]# ifenslavebond0 eth1 eth0

Illegal operation; the specified masterinterface 'bond0' is not up.

[root@rac1 network-scripts]# ifup bond1

[root@rac1 network-scripts]# ifenslavebond1 eth2 eth3

--節點2執行綁定:

[root@rac2 network-scripts]# ifup bond0

[root@rac2 network-scripts]# ifup bond1

[root@rac2 network-scripts]# ifenslavebond0 eth1 eth0

[root@rac2 network-scripts]# ifenslavebond1 eth2 eth3

2.4 設定開機自動綁定

在2個節點分别将如下參數添加到/etc/rc.local中,讓開機自動綁定:

ifenslave bond0 eth0 eth1

ifenslave bond1 eth2 eth3

2.5 重新網絡

[root@rac1 network-scripts]# servicenetwork restart

[root@rac2 network-scripts]# servicenetwork restart

綁定網卡的啟動與關閉:

     # ifdown  bond0

     #ifup      bond0

2.6 檢視網卡資訊

2.6.1 節點1

[root@rac1 /]# ifconfig

bond0    Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E2 

         inet addr:192.168.16.200 Bcast:192.168.16.255 Mask:255.255.255.0

         inet6 addr: fe80::92b1:1cff:fe31:f0e2/64 Scope:Link

         UP BROADCAST RUNNING MASTER MULTICAST MTU:1500  Metric:1

         RX packets:116 errors:0 dropped:0 overruns:0 frame:0

         TX packets:41 errors:0 dropped:0 overruns:0 carrier:0

         collisions:0 txqueuelen:0

         RX bytes:10178 (9.9 KiB)  TX bytes:12096 (11.8 KiB)

bond1    Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E3 

         inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0

         inet6 addr: fe80::92b1:1cff:fe31:f0e3/64 Scope:Link

          UP BROADCAST RUNNING MASTERMULTICAST  MTU:1500  Metric:1

         RX packets:53 errors:0 dropped:0 overruns:0 frame:0

         TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:4214 (4.1 KiB)  TXbytes:334 (334.0 b)

eth0     Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E2 

         UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1

         RX packets:59 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:5530 (5.4 KiB)  TXbytes:5134 (5.0 KiB)

         Interrupt:162 Memory:d51a0000-d51b0000

eth1     Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E2 

         RX packets:57 errors:0 dropped:0 overruns:0 frame:0

         TX packets:20 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:4648 (4.5 KiB)  TXbytes:6962 (6.7 KiB)

         Interrupt:170 Memory:d51d0000-d51e0000

eth2     Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E3 

         RX packets:36 errors:0 dropped:0 overruns:0 frame:0

         RX bytes:2715 (2.6 KiB)  TXbytes:334 (334.0 b)

         Interrupt:178 Memory:d50a0000-d50b0000

eth3     Link encap:Ethernet  HWaddr90:B1:1C:31:F0:E3 

         RX packets:17 errors:0 dropped:0 overruns:0 frame:0

         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:1499 (1.4 KiB)  TXbytes:0 (0.0 b)

         Interrupt:186 Memory:d50d0000-d50e0000

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:813162 errors:0 dropped:0 overruns:0 frame:0

         TX packets:813162 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:406199603 (387.3 MiB)  TXbytes:406199603 (387.3 MiB)

virbr0   Link encap:Ethernet  HWaddr00:00:00:00:00:00 

         inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0

         UP BROADCAST RUNNING MULTICAST MTU:1500  Metric:1

         RX packets:0 errors:0 dropped:0 overruns:0 frame:0

         TX packets:144 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:0 (0.0 b)  TX bytes:27422(26.7 KiB)

[root@rac1 /]#

2.6.2 節點2

[root@rac2 /]# ifconfig

bond0    Link encap:Ethernet  HWaddr90:B1:1C:30:5A:7C 

         inet addr:192.168.16.202 Bcast:192.168.16.255 Mask:255.255.255.0

         inet6 addr: fe80::92b1:1cff:fe30:5a7c/64 Scope:Link

         RX packets:98 errors:0 dropped:0 overruns:0 frame:0

         TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:8096 (7.9 KiB)  TXbytes:9710 (9.4 KiB)

bond1    Link encap:Ethernet  HWaddr 90:B1:1C:30:5A:7D 

         inet addr:192.168.0.200 Bcast:192.168.0.255 Mask:255.255.255.0

         inet6 addr: fe80::92b1:1cff:fe30:5a7d/64 Scope:Link

         RX packets:87 errors:0 dropped:0 overruns:0 frame:0

         TX packets:1 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:6820 (6.6 KiB)  TXbytes:64 (64.0 b)

eth0     Link encap:Ethernet  HWaddr90:B1:1C:30:5A:7C 

         RX packets:38 errors:0 dropped:0 overruns:0 frame:0

         TX packets:11 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

         RX bytes:3302 (3.2 KiB)  TXbytes:1374 (1.3 KiB)

eth1     Link encap:Ethernet  HWaddr90:B1:1C:30:5A:7C 

         RX packets:60 errors:0 dropped:0 overruns:0 frame:0

         TX packets:19 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:4794 (4.6 KiB)  TXbytes:8336 (8.1 KiB)

eth2     Link encap:Ethernet  HWaddr90:B1:1C:30:5A:7D 

         RX packets:44 errors:0 dropped:0 overruns:0 frame:0

         RX bytes:3442 (3.3 KiB)  TXbytes:64 (64.0 b)

eth3     Link encap:Ethernet  HWaddr90:B1:1C:30:5A:7D 

         RX packets:43 errors:0 dropped:0 overruns:0 frame:0

         RX bytes:3378 (3.2 KiB)  TXbytes:0 (0.0 b)

         RX packets:1108104 errors:0 dropped:0 overruns:0 frame:0

         TX packets:1108104 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:387043309 (369.1 MiB)  TXbytes:387043309 (369.1 MiB)

         TX packets:140 errors:0 dropped:0 overruns:0 carrier:0

         RX bytes:0 (0.0 b)  TX bytes:24322(23.7 KiB)

[root@rac2 /]#

2.7 啟動RAC 驗證

[root@rac1 /]# crsctl start crs

CRS-4123: Oracle High Availability Serviceshas been started.

[root@rac2 ~]# crs_stat -t

ora.asm        ora.asm.type   ONLINE   ONLINE    rac1       

ora.cd.db      ora....se.type OFFLINE   OFFLINE              

ora.gsd        ora.gsd.type   OFFLINE  OFFLINE               

ora.rac1.vip   ora....t1.type ONLINE    ONLINE   rac1        

ora.scan1.vip  ora....ip.type ONLINE    ONLINE   rac1  

MOS 文檔:

How to Modify Private Network Informationin Oracle Clusterware [ID 283684.1]