使用 Oracle VM 模板快速部署 Oracle RAC 环境
Oracle VM 模板 其实就是预打包、预配置的虚拟机。在于企业级客户的交流中,我常常用“简单,快速,不出错”来形容使用 Oracle VM 模板来部署应用。Oracle VM 模板为客户节约数天至数周的配置时间,可以真正帮助客户实现应用的快速部署和快速上线。Oracle 提供了一个小工具 Deploycluster 来实现在 Oracle VM 环境中快速部署 Oracle Database 模板。使用 Deploycluster 不但可以部署单实例 Oracle Database, 而且还可以部署多节点 Oracle RAC 环境。
使用 Oracle VM 模板快速部署 Oracle RAC 环境其实有两种部署方式:
- Production – Supported(提供官方支持): where the shared disk is configured as physical devices passed through to the guest Oracle VMs.
- Test – Unsupported(不提供官方支持): where the shared disk is configured as virtual devices
下面我就讲讲如何快速部署 Oracle RAC 环境,由于实验环境有限,我的部署方式介于两者之间:没有直接使用物理硬盘,但是用了两台 Oracle VM Server 来跑 RAC 实例,具体过程如下:
1. 检查 Deploycluster 工具的软件必要条件:
[root@ovm199 ~]# python -V
Python 2.6.6
[root@ovm199 ~]# java -version
java version “1.7.0_45″
OpenJDK Runtime Environment (rhel-2.4.3.3.0.1.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
[root@ovm199 ~]# rpm -qa | grep bc
…
bc-1.06.95-1.el6.x86_64
2. 登录 Oracle VM Manager 执行如下操作:
- 导入下载的 DBRAC 模板
- 修改导入的模板基本配置(CPU,内存和网络)
- 创建5个共享 ASM 虚拟磁盘
- 使用导入的模板一次克隆两个虚拟机
- 为两个虚拟机分别添加共享的5个 ASM 磁盘
3. 解压 Deploycluster 工具
[root@ovm199 ~]# unzip DBRACOVM-Deploycluster-tool.zip
4. 创建 netconfig.ini 文件
[root@ovm199 deploycluster]# cat netconfig.ini
# Node specific information
NODE1=racnode1
NODE1IP=192.168.1.231
NODE1PRIV=racnode1-priv
NODE1PRIVIP=10.10.10.231
NODE1VIP=racnode1-vip
NODE1VIPIP=192.168.1.233
NODE2=racnode2
NODE2IP=192.168.1.232
NODE2PRIV=racnode2-priv
NODE2PRIVIP=10.10.10.232
NODE2VIP=racnode2-vip
NODE2VIPIP=192.168.1.234
# Common data
PUBADAP=eth0
PUBMASK=255.255.255.0
PUBGW=192.168.1.1
PRIVADAP=eth1
PRIVMASK=255.255.255.0
RACCLUSTERNAME=crs64bitR2
DOMAINNAME=localdomain # May be blank
DNSIP= # Starting from 2013 Templates allows multi value
# 11gR2 specific data
SCANNAME=racnode1-racnode2-scan
SCANIP=192.168.1.235
5. 运行 Deploycluster 工具
[root@ovm199 deploycluster]# ./deploycluster.py -u admin -p OracleVM326 -M racnode.0,racnode.1 -N netconfig.ini
Oracle DB/RAC OneCommand (v2.0.3) for Oracle VM – deploy cluster – (c) 2011-2013 Oracle Corporation
(com: 28700:v2.0.2, lib: 180072:v2.0.3, var: 1500:v2.0.3) – v2.6.6 – ovm199.example.com (x86_64)
Invoked as root at Wed Apr 16 15:01:16 2014 (size: 45500, mtime: Wed Jul 31 07:55:37 2013)
Using: ./deploycluster.py -u admin -p **** -M racnode.0,racnode.1 -N netconfig.ini
INFO: Attempting to connect to Oracle VM Manager…
INFO: Oracle VM Client (3.2.4.524) protocol (1.9) CONNECTED (tcp) to
Oracle VM Manager (3.2.6.726) protocol (1.9) IP (192.168.1.199) UUID (0004fb00000100003dd9272e9d3d3ba2)
INFO: Inspecting /root/deploycluster/netconfig.ini for number of nodes defined…
INFO: Detected 2 nodes in: /root/deploycluster/netconfig.ini
INFO: Located a total of (2) VMs;
2 VMs with a simple name of: ['racnode.0', 'racnode.1']
INFO: Detected a RAC deployment…
INFO: Starting all (2) VMs…
INFO: VM with a simple name of “racnode.0″ is in a Stopped state, attempting to start it….OK.
INFO: VM with a simple name of “racnode.1″ is in a Stopped state, attempting to start it….OK.
INFO: Verifying that all (2) VMs are in Running state and pass prerequisite checks…..
INFO: Detected that all (2) VMs specified on command line have (5) common shared disks between them (ASM_MIN_DISKS=5)
INFO: The (2) VMs passed basic sanity checks and in Running state, sending cluster details as follows:
netconfig.ini (Network setup): /root/deploycluster/netconfig.ini
buildcluster: yes
INFO: Starting to send configuration details to all (2) VM(s)…..
INFO: Sending to VM with a simple name of “racnode.0″….
INFO: Sending to VM with a simple name of “racnode.1″……
INFO: Configuration details sent to (2) VMs…
Check log (default location /u01/racovm/buildcluster.log) on build VM (racnode.0)…
INFO: deploycluster.py completed successfully at 15:01:34 in 18.7 seconds (0h:00m:18s)
Logfile at: /root/deploycluster/deploycluster2.log