免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3670 | 回复: 2
打印 上一主题 下一主题

RHEL4-AS-u3-i386 Cluster Suit+Oracle10g2.0.1 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-03 15:58 |只看该作者 |倒序浏览
RHEL4-AS-u3-i386 Cluster Suit+Oracle10g2.0.1

一. 配置信息
1. 软件版本
Linux version: RHEL4-AS-u3-i386
Linux Kernel: 2.6.9-34.EL i686 i686 i386 GNU/Linux
Linux Cluster Software: RED HAT CLUSTER SUITE v. 3
Oracle version: Oracle10.2.0.1
VMware Server 1.0.1 build-29996

节点1信息
hostname: node1
private ip(eth0): 10.1.1.1/8
public ip(eth1): 192.168.1.151/24

节点2信息
hostname: node2
private ip(eth0): 10.1.1.2/8
public ip(eth1): 192.168.1.152/24

share disk: /dev/sdb1 8GB/oradata
                       
Oracle 安装路径规划:
oracle software: /oracle/product/10.2.0/db_1
inventory directory: /oracle/oraIventory
oracel database: /oradata

Linux 用户组规划:
group: dba        gid: 1001
group: onistall   gid: 1002
user:  oracle  uid: 1001   gid: 1002

2. vmware 的配置
(1) 网络配置
作为 private 的网络 eth0 可以配置为 Bridged, NAT, Host-only 模式.
作为 public 的网络 eth1 应该配置成 Bridged 模式.

(2) 共享磁盘配置
A. 首先使用虚拟机的 "Edit virtual machine setting" 菜单在主机 node1 上创建一个硬盘设备, 创建要求是
(a) 创建选上 "Allocate all disk space now" 选项.
(b) 创建时选择硬盘设备占用的 SCSI 号, 如: SCSI 0:1

B. 在另一个虚拟机 node2 也创建一个硬盘设备, 创建要求是
(a) 创建的时候选择 " Use an exiting virtual disk"
(b) 设备的 SCSI 号也应该和第一个节点一致

C. 分区和格式化
(a) 启动节点 node1, 使用 fdisk 和 mkfs 将共享磁盘分区及格式化
(b) 关闭节点 node1
(c) 开启节点 node2, 让操作系统自己识别已经分区和格式化的共享磁盘
(d) 关闭节点 node2

D. 修改虚拟机的配置文件 .vmx
到 node1和node2 虚拟机所在目录, 找到 .vmx 后缀的主配置文件, 使用文本编辑器打开, 在最后添加
disk.locking = "false"

E. 重新依次启动 node1 和 node2, 使用 fdisk 命令查看共享磁盘设备是否正常

二. ClusterWare的安装配置
1. 修改主机配置文件(两个节点上都相同)
   # vi /etc/sysconfig/network

   HOSTNAME=node1

   # vi /etc/hosts   
   127.0.0.1       localhost.localdomain localhost
   192.168.1.151   node1
   10.1.1.1        node1
   192.168.1.152   node2
   10.1.1.2        node2
   192.168.1.153   oraclust
   

2. 安装rhel-4-u3-rhcs-i386.iso的软件(两个节点都安装)
   选择默认有软件包,安装过程中要放入系统安装光盘2,安装kenel-hugemem,kernel-smp软件包
   # ./autorun


3. system-config-cluster启动配置程序,进行群集的配置(只在node1上配置)
(1) 选择 Create New Configuration

(2) Choose a Lock Method
     选择默认的 Distributed Lock Manager(DLM)

(3) 配置Cluster参数
   A. 点击 Edit Cluster Properties

   B. Cluster Properties  
       Name: oracluster
       Config Verison: 1           (数字代表修改配置的次数)
     
   C. Fence Daemon Properities   (保持默认)
        Post-Join Delay: 3
        Post-Fail Delay: 0

(4)  添加cluster nodes
   A. 点击 Add a cluster node
     
   B. Node Properties                       
      Cluster Node Name: node1   输入node1的名字(或ip)
      Quorum Votes:              保持blank(空)

   C. 依次添加节点node2

(5) 配置Fence Devices
     Fence Devices, 和 UPS 监测相关, 暂时不配置

(6) 配置Failover Domains
   A. 选择Create a Failover Domain
   B. 输入Failover Domains 的名字
      Name of Failvoer Domain: oracle

   C. 将两个节点node1和node1都加入domain中
        Restrict Failover To This Domains Members        允许domain中的成员错误恢复
        Prioritzed List     选择节点的优先级别: node1 的优先级别为 1(优先级高), node2 的优先级别为 2
         
(7) 添加资源Resources
     选择Create Resource

   A. 添加一个共享磁盘资源
      Resouce Type: File System    表示资源的类型为文件系统(还有ip address,nfs mount, script,samba service等资源类型)

      Name:  sdb1    资源的名字,随便写
      File System Type:  ext3
      Mount Point: /oracle/oradata
      Device: /dev/sdb1
      Options:                保持空
      File System ID:         保持空
      
      下面的三个选项,安装要求选择
      Force unmount        否
      Reboot host node if unmount fails                是
      Check file system before mounting                否
        
   B. 添加一个集群ip地址资源 192.168.1.153

( 集群服务Service
     添加一个服务:   oracle10g
     选择 Failover Domain: oracle
     Autostart This Service        是
     Run Exclusive        否
     添加服务的资源: 192.168.1.153
                    sdb1
     

(9) 配置完成后选择保存,保存位置为/etc/cluster/cluster.conf
     使用集群菜单 propagate 来拷贝配置文件到 node2 上
     (或者用scp 命令拷贝该文件到node2上的同样位置)

(10) 重新启动集群服务进程
A. 先在 node1 节点上依次执行下列命令
[root@node1 ~]# service cman start
Starting cman:                                             [  OK  ]
[root@node1 ~]# service ccsd restart
Stopping ccsd:                                             [  OK  ]
Starting ccsd:                                             [  OK  ]
[root@node1 ~]# service rgmanager start
Starting Cluster Service Manager:                          [  OK  ]

B. 在 node2 上同样依次执行上面的命令

(11) 查看主机的资源状态(或者重新启动2个节点后进行查看)
A. 查看磁盘资源是否已经自动挂载
  [root@node1 ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2     ext3    7.3G  4.1G  2.9G  59% /
/dev/sda1     ext3     99M   14M   80M  15% /boot
none         tmpfs    189M     0  189M   0% /dev/shm
/dev/sdb1     ext3    4.0G   41M  3.7G   2% /oracle/oradata       

B. 查看 ip 地址是否已经生效
[root@node1 ~]# ping -c 2 192.168.1.153
PING 192.168.1.153 (192.168.1.153) 56(84) bytes of data.
64 bytes from 192.168.1.153: icmp_seq=0 ttl=64 time=0.003 ms
64 bytes from 192.168.1.153: icmp_seq=1 ttl=64 time=1.47 ms

注: 漂移公共 ip 地址, 并不能够使用 ifconfig 查看       
[root@node1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B8:E7:4E  
          inet addr:10.1.1.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:feb8:e74e/64 Scope:Link

eth1      Link encap:Ethernet  HWaddr 00:0C:29:B8:E7:58  
          inet addr:192.168.1.151  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb8:e758/64 Scope:Link

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0

C. 查看集群的状态
[root@node1 ~]# clustat
Member Status: Quorate

  Member Name                              Status
  ------ ----                              ------
  node1                                    Online, Local, rgmanager
  node2                                    Offline

  Service Name         Owner (Last)                   State         
  ------- ----         ----- ------                   -----         
  oracle10g            node1                          started  

[root@node1 ~]# clustat -i 5                /* 每隔 5 秒钟刷新监测集群的状态

(12) 集群服务的启动 (需要安照顺序执行)
A. service ccsd start
B. "service lock_gulmd start" or "service cman start" according to the type of lock manager used
C. service fenced start (DLM clusters only)
D. service clvmd start
E. service gfs start, if you are using Red Hat GFS
F. service rgmanager start

4. 集群切换测试
(1) 关闭主机 node1, 查看集群资源是否能够切换到 node2 上. (能够切换)
(2) 开启主机 node1, 查看集群资源是否自动切回到 node1 上. (自动切换回到 node1 上, 因为集群 failover 资源组 oracle 中指定 node1 的优先级要高于 node2 的优先级.
(3) 关闭主机 node2, 查看集群资源十分能够切换到 node1 上. (能够切换)
      

二. 安装oracle数据库程序(现在node2上安装)
1. 创建用户和相关的组,并添加环境变量(两个节点上分别操作,并且要完全一样)
(1)创建OSDBA用户组(一般为dba)
   该用户组对Oracle数据库具有管理员权限(SYSDBAprivilege),缺省组名为dba.
   如果改变该组名称,那么安装Oracle时必须选择定制安装,或者使用一个非该组(dba)成员的用户来运行Oracle Universal Installer,这样在安装的时候会提示你输入组名.
   命令如下:
# /usr/sbin/groupadd -g 1001 dba     
  -g 后面定义dba用户组的group id号,单机安装环境下可以不定义id号

(2)OSOPER组(一般为oper)
   该组是可选的,如果想将Oracle的操作组用户(对数据库的管理权限受到一定的限制,拥有SYSOPER Privilege)分离出来,就创建该用户组.缺省情况下,OSDBA用户组的成员也拥有SYSOPER权限.
   此步骤的操作是可以省略的.
   
(3)匿名用户(nobody)
   确定匿名用户nobody是否存在于系统中,安装完成后nobody用户必须执行一些扩展任务(extjob)
   # id nobody
   如果用户不存在,添加该用户

(4)Oracle产品清单(Oracle Iventory)用户组(一般为oinstall)
# /usr/sbin/groupadd -g 1002 oinstall

(5)Oracle软件拥有者(一般为用户oracle)
   该用户为安装过程中所有安装的软件的拥有者.该用户的主要组必须是Oracle Inventory组(oinstall),同时必须是OSDBA和OSOPERY组的成员.
# /usr/sbin/useradd -u 1001 -g oinstall -G dba oracle 

# su – oracle  
$ cd  
$ vi .bash_profile
#添加如下内容,路径和ORACLE_SID(也就是创建的数据库名)的具体值根据你的实际情况修改.
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=testdb
export PATH=$PATHHOME/binORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8
unset USERNAME

2.确保以下包都正确安装(两个节点上)
  使用命令"rpm -q 软件包",可以来确定系统中有那些软件都没有安装,软件列表如下:
make-3.80-5
openmotif-devel-2.2.3-6.RHEL4.2        /* 可以不安装
openmotif-2.2.3-6.RHEL4.2
binutils-2.15.92.0.2-10.EL4
setarch-1.6-1
compat-db-4.1.25-9
compat-gcc-32-c++-3.2.3-47.3
compat-libstdc++-33-3.2.3-47.3
compat-gcc-32-3.2.3-47.3
libaio-0.3.96 (或者更高,此例中安装的是libaio-0.3.102-1)

可以用一条命令来验证:
rpm -q make openmotif-devel openmotif binutils setarch compat-db compat-gcc-32-c++ compat-libstdc++-33 compat-gcc-32 libaio
注意:这些软件包之间是有依赖性的,安装的时候会有先后上的顺序,否则会有不能够安装错误提示.

软件包的位置如下:
#From RedHat AS4 Disk 2
cd /media/cdrom/RedHat/RPMS
rpm -Uvh setarch-1.6-1.i386.rpm
rpm -Uvh compat-libstdc++-33-3.2.3-47.3.i386.rpm
rpm -Uvh make-3.80-5.i386.rpm
rpm -Uvh glibc-2.3.4-2.i386.rpm

# From RedHat AS4 Disk 3
cd /media/cdrom/RedHat/RPMS
rpm -Uvh openmotif-2.2.3-6.RHEL4.2.i386.rpm
rpm -Uvh compat-db-4.1.25-9.i386.rpm
rpm -Uvh libaio-0.3.102-1.i386.rpm
rpm -Uvh gcc-3.4.3-9.EL4.i386.rpm

# From RedHat AS4 Disk 4
cd /media/cdrom/RedHat/RPMS
rpm -Uvh compat-gcc-32-3.2.3-47.3.i386.rpm
rpm -Uvh compat-gcc-32-c++-3.2.3-47.3.i386.rpm
注:update中有些文件版本可能会不同,但名称是一样的。

3. Oracle 安装目录的创建及授权
(1) 创建安装目录并授权 (两个节点同样)
# mkdir /oracle
# chown -R oracleinstall /oracle
# chmod -R 755 /oracle

(2) 使用 fdisk 对共享磁盘 /dev/sdb 进行分区(只在 node1 节点上操作)
划分一个主分区: /dev/sdb1
容量: 4GB

(3) 建立挂载目录(两个节点上操作)
# mkdir /oracle/oradata

(4) 使用 mkfs 对分区 /dev/sdb1 进行格式化并挂载(只在 node1 节点上操作)
[root@node1 ~]# mkfs -t ext3 /dev/sdb1
[root@node1 ~]# mount /dev/sdb1 -t ext3 /oracle/oradata

(5) 对共享磁盘目录进行授权(只在 node1 节点上操作)
[root@node1 ~]# chown -R oracleinstall /oracle/oradata
[root@node1 ~]# chmod -R 755 /oracle/oradata

  注: 这里的目录可以在安装过程中创建,但是,在安装过程中创建的目录必须和前面设置oracle用户环境变量保持一致

4.修改核心参数(两个节点同样)
(1)#vi /etc/sysctl.conf
在该文件末尾加入如下内容:
#-----------Begin from here--------------------------------------
# for oracle
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
#--------------End here--------------------------------------------
编辑完之后,保存

(2)执行 # /sbin/sysctl -p 命令操作来使我们所做的变更生效.

(3)可以用 root 用户身份运行以下命令来验证您的设置:
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range

5.为Oracle用户设定Shell的限制(两个节点同样)
一般来说,还需要需要进行如下的设定,以便改进Oracle用户的有关nofile(可打开的文件描述符的最大数)和nproc(单个用户可用的最大进程数量)
(1) # vi /etc/security/limits.conf
# 添加如下的行

# for oracle
oracle     soft    nproc   2047
oracle     hard    nproc   16384
oracle     soft    nofile  1024
oracle     hard    nofile  65536

(2)添加如下的行到/etc/pam.d/login 文件:

# for oracle
session    required     /lib/security/pam_limits.so

(3)编辑/etc/profile, 添加如下内容
# for oracle
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
                ulimit -p 16384
                ulimit -n 65536
        else
                ulimit -u 16384 -n 65536
        fi
fi

6. 开始安装
(1)解压缩和拷贝
[root@node1 ~]# mount /dev/cdrom
[root@node1 ~]# su - oracle
[oracle@node1 ~]$ /media/cdrom/runInstaller

(2)安装目录下输入./runInstaller开始图形界面的安装
   如果采用的是远程ssh或者telnet登陆的方式来安装,由于oracle的安装程序是图形化界面的,一般登陆终端secureCRT,hypertrm等都是不支持图形输出的.
   A. 在工作站上安装Xmanager(Xmanager启动passive模式)或exceed等工具

   B. 在Linux终端下使用命令"export DISPLAY=192.168.1.188:0.0"来将命令的图形输出重定向到Xmanager等工具的输出上.
     这样做的好处是用户可以方便地在做操作的时候查阅资料和文档,及向终端中拷贝事先编辑好的命令和参数等.

(3)早些版本的oracle 10G 不支持在 RHAS4 上进行安装,所以在运行安装命令时加上-ignoreSysPrereqs参数跳过检测.

7.安装过程及信息记录(分别在两个节点上,并且安装目录和安装的参数要完全一样)
(1)选择Advanced Installation

(2)定制产品清单目录和信任状(Specify Inventory directory and credentials)
A. 定制产品清单目录
You are starting your first installation on this host. As part of this install, you need to specify a directory for installer files. This is called the "inventory directory". Whihin the inventory directory, the installer autmatically set up subdirectories for each product to contain inventory data and will consume typically 150 Kilobytes per product.

Enter the full path of the inventory directory:
/oracle/oraInventory

B. 定制产品清单更新组
You can specify an Operating System group that has write permission to the above inventory directory. You can leave the field blank if you want to perform the above operations as a Superuser.

Sepcify Operationg System group name:
oinstall

(3)Select Installation Type 和语言
   选择安装类型为: Custom
   选择安装语言: 添加"Simplefiled Chinese"

(4)选择安装目录(Specify Home Detail)
   Name: OraDb10g_home1
   Path: /oracle/product/10.2.0/db_1

(5)选择安装的软件包(Available Product Components)
   添加一个组件: iSQL*Plus 10.2.0.1.0

(6) 下面系统开始检测安装的必备条件(Product-Specific Prerequisite Checks)
   检测结果的Summary中有2个Warnings,用户需要确认不能满足的条件(分别是memory和swap的)
   勾选确认了两个Warning.

(7) 输入特权操作系统用户组(Privilege Operation System Groups)
    Database Administrator(OSDBA) Group:  dba
    Database Operator(OSOPER) Group: dba

( 创建数据库(Create Database)
    选择仅安装数据库软件(Install database Software only)

(9)确认安装清单并开始安装
   系统会根据前面的配置生成安装清单(Summary)确认后就可以开始数据库的安装.
   
(10)执行脚本(必须使用root用户)
[root@node1 ~]# /oracle/oraInventory/orainstRoot.sh
Changing permissions of /oracle/oraInventory to 770.
Changing groupname of /oracle/oraInventory to oinstall.
The execution of the script is complete
[root@node1 ~]# /oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.

[root@node2 ~]# ls /etc/ora
oraInst.loc  oratab

(11)脚本执行完成后,继续安装,直至完成.
    安装完成后的信息:
The following J2EE Applications have been deployed and are accessible at the URLs listed below.

iSQL*Plus URL:
http://node1:5560/isqlplus

iSQL*Plus DBA URL:
http://node1:5560/isqlplus/dba


8. 采用相同的配置选项,同样也在node1上安装

四. 使用dbca创建数据库(只在node1上)
1. 使用oracle用户登陆,并运行dbca(Database Configuration Assistant).

2. 选择"Create a Database"创建数据库,并选择数据库 Template 为 "Custom Database"

3. 输入全局数据库名和数据库sid
  Global Database Name: testdb
  SID: testdb

4. 选择管理数据库选项(保持默认)
Configurate the Database with Enterprise Manager   (使用em来管理数据库)
Use Database Control for Database Management

5. 输入数据库的密码
Use the Same Password for All Accounts (SYS,SYSTEM,DBSNMP,SYSMAN)
Password: orcl
Confirm Password: orcl

6. 选择数据库存储方式(Select the storage mechanism you would like to for the database.)
   File System

7. Specify location for the Database files to be created:

8. Choose the recovery options for the database:
(1) Specify Flash Recovery Area(选择采快闪恢复存区)
     Flash Recovery Area: {ORACLE_BASE}/oradata/{DB_NAME}/flash_recovery_area
     Flash Recovery Area Size: 1024M

(2) Enable Archiving (启用日志归档)
     Archive Log File Format: %t_%s_%r.dbf
     Archive Log Destinations: {ORACLE_BASE}/oradata/{DB_NAME}/archive
  
  注: If you have specified Flash Recovery Area, archive logs will go there. If you specify any other archive log destinations, they will be used instead of Flash Recovery Area. It is recommended that archive log files be written to multiple locations spread across different disks.

论坛徽章:
0
2 [报告]
发表于 2007-09-02 01:42 |只看该作者
不错不错...正需要.

论坛徽章:
0
3 [报告]
发表于 2007-11-08 17:30 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP