这是 VCS 下最简单的 Oracle DB 配置之一。
在实际场景中,我们可能配置了更多挂载点和多路径。
但是一旦我们掌握了配置每个资源以及如何链接它们背后的基础知识,就可以轻松地在 VCS 下配置任何复杂的设置。
准备工作:
- Oracle应该安装在挂载点/oracle/product/10.2.0的共享存储上
- 所有的Data和其他文件都会存放在/u01/oradata下
- 192.168.1.4将作为虚拟IP连接DB。
在故障转移的情况下,这个 IP 从一个节点到另一个节点失败
以写入模式打开集群配置
# haconf -makerw
添加配置oracle服务组ORASG
# hagrp -add ORASG # hagrp -modify ORASG SystemList node01 0 node02 1 # hagrp -modify ORASG AutoStartList node01 node02
ORASG 服务组的main.cf 配置示例
group ORASG ( SystemList = { node01 = 0, node02 = 1 } AutoStartList = { node01, node02 } )
将资源添加到服务组并配置它们
- Oracle 数据库资源
# hares -add ORA_RES Oracle ORASG # hares -modify ORA_RES Critical 0 # hares -modify ORA_RES Sid ORA01 ###(ORA01 -> Oracle DB instance Name) # hares -modify ORA_RES Owner oracle ###(oracle -> Owner for Oracle) # hares -modify ORA_RES Home /oracle/product/10.2.0 ####(/oracle/product/10.2.0 -> Oracle Home Directory) # hares -modify ORA_RES Pfile /oracle/product/10.2.0/dbs/initORA01.ora ### optional parameter # hares -modify ORA_RES Enabled 1 # hares -online ORA_RES -sys node01
oracle 资源的 main.cf 配置示例
Oracle ORA_RES ( Sid = ORA01 Owner = oracle Home = "/oracle/product/10.2.0" Pfile = "/oracle/product/10.2.0/dbs/initVRT.ora" )
- 监听资源
# hares -add LISTR_RES Netlsnr ORASG # hares -modify LISTR_RES Critical 0 # hares -modify LISTR_RES Owner oracle ###(oracle -> Owner for Oracle) # hares -modify LISTR_RES Home /oracle/product/10.2.0 ###(/oracle/product/10.2.0 -> Oracle Home Directory) # hares -modify LISTR_RES TnsAdmin /oracle/product/10.2.0/network/admin # hares -modify LISTR_RES Listener ORA01 ### optional parameter # hares -modify LISTR_RES Enabled 1 # hares -online LISTR_RES -sys node01
监听器的 main.cf 配置示例
Netlsnr LISTR_RES ( Owner = oracle Home = "/oracle/product/10.2.0" TnsAdmin = "/oracle/product/10.2.0/net/admin" Listener = LISTENER LsnrPwd = S2cEjcD5s3Cbc )
- IP资源
# hares -add IP_RES IP ORASG # hares -modify IP_Prod Address 192.168.1.4 ###(192.168.1.4 -> Virtual IP) # hares -modify IP_Prod Device e1000g0 ###(e1000g0 -> NIC Device)
IP 资源的 main.cf 配置示例
IP IP_RES ( Device = e1000g0 Address = "192.168.1.4" )
- 网卡资源
# hares -add NIC_RES NIC ORASG # hares -modify NIC_RES Device e1000g0
NIC 资源的main.cf 配置示例
NIC NIC_RES ( Device = e1000g0 )
- 卷资源
# hares -add ORAVOL_RES Volume ORASG # hares -modify ORAVOL_RES Volume oravol ###(oravol -> volume for Oracle Home) # hares -modify ORAVOL_RES DiskGroup oradg ###(oradg -> Diskgroup for volume)
卷资源的 main.cf 配置示例
Volume ORAVOL_RES ( Volume = oravol DiskGroup = oradg )
- 磁盘组资源
# hares -add ORADG_RES DiskGroup ORASG # hares -modify ORADG_RES DiskGroup oradg # hares -modify ORADG_RES DiskGroupType private
磁盘组资源的 main.cf 配置示例
DiskGroup ORADG_RES ( DiskGroup = oradg )
- 挂载资源
# hares -add ORAMOUNT_RES Mount ORASG # hares -modify ORAMOUNT_RES BlockDevice /dev/vx/dsk/oradg/oravol # hares -modify ORAMOUNT_RES FSType vxfs # hares -modify ORAMOUNT_RES FsckOpt "%-y" # hares -modify ORAMOUNT_RES MountPoint /u01/oradata
挂载资源的 main.cf 配置示例
Mount MOUNT_RES ( MountPoint = "/u01/oradata" BlockDevice = "/dev/vx/dsk/oradg/oravol" FSType = vxfs FsckOpt = "-y" )
链接资源
# hares -link LISTR_RES ORA_RES # hares -link ORA_RES IP_RES # hares -link ORA_RES ORAMOUNT_RES # hares -link ORAVOL_RES ORADG_RES # hares -link ORAMOUNT_RES ORAVOL_RES # hares -link IP_RES NIC_RES
在 node01 上:
# hagrp -online ORASG -sys node1
现在检查 #hastatus -sum 并验证 SG 上的状态。
故障转移 SG 到 node02 :
# hagrp -switch ORASG -to node02
检查 # hastatus -sum 并确认服务组的状态。
在检查故障转移是否正确后,我们可以将所有资源的关键属性设置为 1.
这将确保在服务组中的任何资源发生故障时进行故障转移。
保存并关闭集群配置
# haconf -dump -makero
日期:2020-09-17 00:15:29 来源:oir作者:oir