之前在vmware上搭了一个rac,在配置rac的时候,由于当时的电脑是接在路由器上的,因此将public和vip配置在了需要连接路由器的IP上,用的是bridge的连接方式。但是也造成了一个不便,就是在没有连接路由的情况下,public和vip无法连接,因此我希望用host only而不是bridge的连接方式,将rac的vip改为vmware的虚拟网卡的IP。
改造之前:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
192.168.190.131 rac1 192.168.1.31 rac1-vip 10.10.10.31 rac1-priv 192.168.190.132 rac2 192.168.1.32 rac2-vip 10.10.10.32 rac2-priv 192.168.190.133 rac3 192.168.1.33 rac3-vip 10.10.10.33 rac3-priv 其中rac1的2块网卡,rac2和rac3的类似: eth0 192.168.1.131 用bridge连接 eth1 10.10.10.31 用host only连接 |
另外,vmware的虚拟网卡,在这次改造中不做变化:
1 2 3 4 |
VMware Network Adapter VMnet1:192.168.190.1 VMware Network Adapter VMnet8:192.168.174.1 路由器的网关地址:192.168.1.200 |
改造后:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
192.168.190.131 rac1 192.168.190.31 rac1-vip 10.10.10.31 rac1-priv 192.168.190.132 rac2 192.168.190.32 rac2-vip 10.10.10.32 rac2-priv 192.168.190.133 rac3 192.168.190.33 rac3-vip 10.10.10.33 rac3-priv 其中rac1的2块网卡,rac2和rac3的类似: eth0 192.168.190.131 用host only连接 eth1 10.10.10.31 用host only连接 |
修改步骤:
1.停数据库和crs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
只在一个节点上运行: crs_stop -all 检查: rac1-> crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.devdb.db application OFFLINE OFFLINE ora....b1.inst application OFFLINE OFFLINE ora....b2.inst application OFFLINE OFFLINE ora....b3.inst application OFFLINE OFFLINE ora....SM1.asm application OFFLINE OFFLINE ora....C1.lsnr application OFFLINE OFFLINE ora.rac1.gsd application OFFLINE OFFLINE ora.rac1.ons application OFFLINE OFFLINE ora.rac1.vip application OFFLINE OFFLINE ora....SM2.asm application OFFLINE OFFLINE ora....C2.lsnr application OFFLINE OFFLINE ora.rac2.gsd application OFFLINE OFFLINE ora.rac2.ons application OFFLINE OFFLINE ora.rac2.vip application OFFLINE OFFLINE ora....SM3.asm application OFFLINE OFFLINE ora....C3.lsnr application OFFLINE OFFLINE ora.rac3.gsd application OFFLINE OFFLINE ora.rac3.ons application OFFLINE OFFLINE ora.rac3.vip application OFFLINE OFFLINE rac1-> 在所有节点上执行: [root@rac1 bin]# /etc/init.d/init.crs stop Shutting down Oracle Cluster Ready Services (CRS): Stopping resources. Successfully stopped CRS resources Stopping CSSD. Shutting down CSS daemon. Shutdown request successfully issued. Shutdown has begun. The daemons should exit soon. [root@rac1 bin]# |
2.修改hosts的文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[root@rac1 bin]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost 192.168.190.131 rac1.mycorpdomain.com rac1 192.168.190.31 rac1-vip.mycorpdomain.com rac1-vip 10.10.10.31 rac1-priv.mycorpdomain.com rac1-priv 192.168.190.132 rac2.mycorpdomain.com rac2 192.168.190.32 rac2-vip.mycorpdomain.com rac2-vip 10.10.10.32 rac2-priv.mycorpdomain.com rac2-priv 192.168.190.133 rac3.mycorpdomain.com rac3 192.168.190.33 rac3-vip.mycorpdomain.com rac3-vip 10.10.10.33 rac3-priv.mycorpdomain.com rac3-priv ## ntp server 192.168.190.1 HEJIANMIN [root@rac1 bin]# |
3.修改主机的IP。
4.由于采用了ocfs2,将crs和votingdisk放在ocfs2上,修改主机IP之后,重启主机之前,也需要修改ocfs2的配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
原来: [root@rac1 bin]# cat /etc/ocfs2/cluster.conf node: ip_port = 7777 ip_address = 192.168.1.131 number = 0 name = rac1 cluster = ocfs2 node: ip_port = 7777 ip_address = 192.168.1.132 number = 1 name = rac2 cluster = ocfs2 node: ip_port = 7777 ip_address = 192.168.1.133 number = 2 name = rac3 cluster = ocfs2 cluster: node_count =3 name = ocfs2 [root@rac1 bin]# 现改成: [root@rac1 bin]# cat /etc/ocfs2/cluster.conf node: ip_port = 7777 ip_address = 192.168.190.131 number = 0 name = rac1 cluster = ocfs2 node: ip_port = 7777 ip_address = 192.168.190.132 number = 1 name = rac2 cluster = ocfs2 node: ip_port = 7777 ip_address = 192.168.190.133 number = 2 name = rac3 cluster = ocfs2 cluster: node_count =3 name = ocfs2 [root@rac1 bin]# |
注意如果不改ocfs配置,会在启动crs的时候报错,共享存储只会在第一个启动的机器上挂载。
5.重启主机,注意将网卡模式改为host only。
6.在3个节点上启动crs服务:/etc/init.d/init.crs start,重启后记得再次crs_stop。
7.用oifconfig来修改网卡被oracle使用的方式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#检查: [root@rac1 bin]# ./oifcfg getif eth0 192.168.1.0 global public eth1 10.10.10.0 global cluster_interconnect [root@rac1 bin]# [root@rac1 bin]# #修改: [root@rac1 bin]# ./oifcfg delif -global eth0/192.168.1.0 [root@rac1 bin]# ./oifcfg setif -global eth0/192.168.190.0:public [root@rac1 bin]# [root@rac1 bin]# #再次检查: [root@rac1 bin]# ./oifcfg getif eth0 192.168.190.0 global public eth1 10.10.10.0 global cluster_interconnect [root@rac1 bin]# |
8.修改vip,注意这里是vip,不是public ip:
1 2 3 4 |
[root@rac1 bin]# ./srvctl modify nodeapps -n rac1 -A 192.168.190.31/255.255.255.0/eth0 [root@rac1 bin]# ./srvctl modify nodeapps -n rac2 -A 192.168.190.32/255.255.255.0/eth0 [root@rac1 bin]# ./srvctl modify nodeapps -n rac3 -A 192.168.190.33/255.255.255.0/eth0 [root@rac1 bin]# |
9.修改侦听中的vip为新地址。
10.crs_start 启动rac。