实施了一次RHEL双机Oracle的项目,实施过程惨不忍睹,2套HA,做了一个星期。

时隔一月,总算有时间把实施过程总结一下了。随手写几点遇到的情况。

一、安装RHEL6和HA环境

在安装RHEL6操作系统的时候,可以手工的把HA模块勾上,让RHEL自动安装。

如果安装系统的时候没有选择,那就手工安装吧:安装 ricci、cman、rgmanager、lvm2-cluster。

 

二、配置RHEL6YUM源的方法:

1.Mount RHEL 6 ISO to /media/rhel6

# mount -o loop RHEL6.0-20101111.0-Server-x86_64-DVD.iso /media/rhel6

(挂载本地iso镜像安装采用此方式)

# mount /dev/cdrom /media/rhel6

(挂载光驱安装采用此方式)

2.Copy media.repo file from the RHEL 6 ISO to /etc/yum.repos.d/

# cp /media/media.repo /etc/yum.repos.d/rhel6.repo

3.Configure the repo file to point to the /media/rhel6

# vi /etc/yum.repos.d/rhel6.repo

4.add following line :

baseurl=file:///media/rhel6/Server

5.If you want to configure repository for HighAvailability , LoadBalancer , ResilientStorage , ScalableFileSystem then you can add following lines in rhel6.repo file(如果你想配置高可用,负载均衡,存储及扩展文件系统,添加如下内容:)

[dvd-HighAvailability]

mediaid=1289489697.332694

name=DVD for RHEL6 - HighAvailability

baseurl=file:///media/rhel6/HighAvailability

enabled=1

gpgcheck=0

[dvd-LoadBalancer]

mediaid=1289489697.332694

name=DVD for RHEL6 - LoadBalancer

baseurl=file:///media/rhel6/LoadBalancer

enabled=1

gpgcheck=0

[dvd-ResilientStorage]

mediaid=1289489697.332694

name=DVD for RHEL6 - ResilientStorage

baseurl=file:///media/rhel6/ResilientStorage

enabled=1

gpgcheck=0

[dvd-ScalableFileSystem] //这个只有在x86_64的光盘里面才有

mediaid=1289489697.332694

name=DVD for RHEL6 - ScalableFileSystem

baseurl=file:///media/rhel6/ScalableFileSystem

enabled=1

gpgcheck=0

6. 保存上面的内容,执行下面的命令:

# yum list

# yum grouplist 如果显示出很多 rpm 包的名字,那么说明配置成功了。

 三、关于lvm2的限制,或者说最大的数量。lvm2的最大数量为4G即4294967296个。 同时对单个lv的最大大小也有限制,如下:The answer to this question depends upon the CPU architecture of your computer and the kernel you are a running:    For 2.4 based kernels, the maximum LV size is 2TB. For some older kernels, however, the limit was 1TB due to signedness problems in the block layer. Red Hat Enterprise Linux 3 Update 5 has fixes to allow the full 2TB LVs. Consult your distribution for more information in this regard.    For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.    For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB. (Yes, that is a very large number.)

四、如果添加节点的时候报这个错误“The following errors occurred while creating cluster "zzdagora": %d format: a number is required, not Unicode”这个就是RHEL6.0的Luci的Bug,只能卸载老版本的Luci用最新版的Luci。rm -rf /var/lib/luci #删除clui的数据库yum -y remove luci #删除luci软件 yum -y install luci #重新安装软件 在确保2个节点cman停止的情况下,通过luci重新配置cluster. 

五、配置ILO3 IP地址

配置好节点内服务器的ILO3的IP和管理员帐号,具体方法google吧。

http://www.51kvm.com/technology/sp_10003.asp

 

六、关于HP ILO3接口RHCS的支持问题

RHEL6中的Cluster是不支持ILO3的,只能使用fence_ipmilan来实现

The iLO3 firmware should be a minimum of 1.15 as provided by HP.

On both cluster nodes, install the following OpenIPMI packages used for fencing:$ yum install OpenIPMI OpenIPMI-tools

Stop and disable the 'acpid' daemon:$ service acpid stop; chkconfig acpid off

Test ipmitool interaction with iLO3:$ ipmitool -H <ilo_ip> -I lanplus -U <ilo_username> -P <ilo_password> chassis power status

The desired output is:Chassis Power is on

Test that fencing is successful.  From node1 attempt to fence node2 as follows:$ fence_node node2

测试成功的话,直接在Luci Web界面中配置Fence资源吧。

 

七、配置集群

添加节点名称和成员

添加fence设备,注意:这里的Fence设备要选择ipmila

之后在节点界面,点节点名称,关联节点和Fence设备。

添加故障切换域

添加源:虚拟IP、共享卷、脚本等

添加服务

集群的安装、配置就到这里了。

 

八、下面是Oracle,这个和其他的双机软件配置差不多。

两台机器上的Oracle安装配置等要一致。Oracle安装到本地,用DBCA创建数据库,库文件、控制文件、联机重做日志文件等都放到共享盘柜上。

注意: 创建数据库的时候最好和应用方沟通好细节问题,如字符集、归档、连接模式等,虽然之后可以改,但还是建议事先沟通。

 

九、Oracle的起停脚本

操作如下:
在root账户下修改/etc/oratab 文件:
# vi /etc/oratab
找到orcl=/db/app/oracle/product/11.1.0/db_1 :N这一行
改为:
orcl=/db/app/oracle/product/11.1.0/db_1 :Y
也就是将最后的N改为Y,意思是将不允许自动启动改为允许自动启动。

注意:RHEL的HA必须按照上述设置

修改ORACLE自带的启动与关闭脚本,分别是dbstartdbshut

在oracle账户下修改$ORACLE_HOME/bin/dbstart文件:

# su - ORACLE
$ cd $ORACLE_HOME/bin
$ vi dbstart

找到 ORACLE_HOME_LISTNER=$1这一行
改为:
ORACLE_HOME_LISTNER=$ORACLE_HOME

然后同样的方案 修改dbshut文件。

这个脚本被放在/etc/init.d目录中,脚本的名字是oracle11g

 

#!/bin/bash

#chkconfig:2345 99 10

#description:StartupScriptfororacleDatabases

#/etc/rc.d/init.d/oradbstart

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1/

export ORACLE_SID=orcl

export PATH=$PATH:$ORACLE_HOME/bin

case "$1" in

start)

echo"-----startuporacle-----"&gt;&gt;/var/log/oracle11log

su - oracle -lc $ORACLE_HOME/bin/dbstart

touch /var/lock/subsys/oracle11

echo "-----startuporaclesuccessful-----"&gt;&gt;/var/log/oracle11log

echo "OK"

;;

stop)

echo"-----shutdwnoracle-----"&gt;&gt;/var/log/oracle11log

su - oracle -lc $ORACLE_HOME/bin/dbshut

rm -f /var/lock/subsys/oracle11

echo "-----shutdownoraclesuccessful-----"&gt;&gt;/var/log/oracle11log

echo "OK"

;;

status)

status oracle

;;

*)

echo "usage: oracle11g { start | stop | status}"

exit 1

esac

exit 0

先写到这里吧,写的很乱,想到了再添加。

 

十、参考的资料:

http://hi.baidu.com/btpolo/blog/item/0e89ccfb23c45f7e034f56af.html

http://32727.blog.51cto.com/22727/687485

 

红帽官方中文文档:

http://docs.redhat.com/docs/zh-CN/Red_Hat_Enterprise_Linux/6/html/Cluster_Administration/index.html

 

RHEL6_LAMP环境双机热备.pdf:

http://bbs.51cto.com/thread-861411-1.html