规划:

主备模式,安装ORACLE应用

ORACLE安装在共享非并发卷组datavg

使用磁盘心跳heartvg

 

1.        软件环境

1.1  AIX 6.1

1.2  POWERHA 6.1

 

2.  硬件环境

2AIX分区,配2块网卡

存储一台

 

 

先安装AIX系统,并安装以下文件集:

bos.clvm.enh

bos.data

rsct.basic

(rsct.basic.hacmp rsct.basic.sp rsct.basic.rte )

rsct.compat.basic

(rsct.compat.basic.hacmp rsct.compat.basic.rte rsct.compat.basic.sp)

rsct.compat.clients

(rsct.compat.clients.hacmp rsct.compat.clients.rte rsct.compat.clients.sp)

bos.perf.tools

perfagent.tools //加粗的这些默认已安装

bos.adt.syscalls

bos.adt.libm

 

扩展/usr文件系统,安装ML

   

3.3 安装POWERHA 6.1

 

 

3.  系统环境2台都要配置

3.1  /etc/hosts

 

127.0.0.1 loopback localhost

192.168.0.100   node1_boot (第1块物理网卡IP  en0 hostname

192.168.0.200   node2_boot

 

        192.168.1.100   node1_stdby   (第2块物理网卡IP

192.168.1.200   node2_stdby

 

192.168.2.100   svc

 

 

server ip用来与程序的客户端通信用,主机宕机后,该IP就会从主机飘逸到另外一台备用机器上

server ip可以是一个,也可以是两个(主备是1个,互备是2个)

 

3.2  修改/usr/es/sbin/cluster/etc/rhosts文件:/.rhosts文件为被替代

        node1_boot

node2_boot

node1_stdby

node2_stdby

svc

 

   修改该文件权限为600

   Chmod 600 xxx

 

更改时区

Smitty

   -System Environments

   -Change / Show Date and Time

   -Change Time Zone Using System Defined Values如下图

POWERHA 6.1配置文档

选择cut+8

 

 系统时间

  Smitty date

 

HACMP软件安装

#smitty install(cluster.hativolicluster.haview不装外,其他全部安装)

POWERHA 6.1配置文档

 

以上两台机器都要配置

 

 

 

 

 

 

配置共享卷组

 

在共享存储上划分LUN给这两条机器,hdisk2。配成非并发卷组datavg

node1:

#smit mkvg

POWERHA 6.1配置文档

 

 

 

卷组名取datavg

Hdisk2是共享存储

此处需注意卷组的主编号在从机上也未使用,可在/dev/里使用ls  -l查看主编号

 

备机上执行:

node2:

chdev -l hdisk2 -a pv=yes

#importvg -y'datavg' -V'49' hdisk2  

 

 

增强并发卷组(磁盘心跳)

主节点执行:创建立并发卷组heartvg该步骤可以在执行4.1.2后操作,否则不出现节点名称

#smitty hacmp -> System Management (C-SPOC)->  Storage->  Volume Groups->

  Create a Volume Group?->选中节点,再选择hdisk1,创建磁盘心跳

 

 

# lspv

hdisk0          00f74b0737faad79                    rootvg          active

hdisk1          00f74b073ff9e4d4                    heartvg        

hdisk2          00f74b073ff3d4b1                    datavg          active

 

 

在第一个节点和第二个节点的/etc/environmentPATH最后加入:/usr/sbin/rsct/bin

 

测试磁盘心跳:

 重新使用root登录第一节点和第二节点,执行如下命令。出现以下类似情况说明磁盘心跳测试通过。

[dbsvr1]#dhb_read -p hdisk8 -r

DHB CLASSIC MODE

First node byte offset: 61440

Second node byte offset: 62976

Handshaking byte offset: 65024

       Test byte offset: 64512

 

Receive Mode:

Waiting for response . . .

Magic number = 0x87654321

Magic number = 0x87654321

Magic number = 0x87654321

Magic number = 0x87654321

Link operating normally

 

[dbsvr2]#dhb_read -p hdisk8 -t

DHB CLASSIC MODE

First node byte offset: 61440

Second node byte offset: 62976

Handshaking byte offset: 65024

      Test byte offset: 64512

 

Transmit Mode:

Magic number = 0x87654321

Detected remote utility in receive mode.  Waiting for response . . .

Magic number = 0x87654321

Magic number = 0x87654321

Link operating normally

 

 

 

 

查看群集通信守护进程

分别查看2个机器上的/etc/inittab文件的最后几行是否包含以下部分:

clcomdES:2:once:startsrc -s clcomdES >/dev/console 2>&1

主要用于启动Cluster Communications Daemon (clcomd),这也是在配置HACMP时,运行自动发现过程所需要的。(不一定有,不用管

 

ctrmc:2:once:/usr/bin/startsrc -s ctrmc > /dev/console 2>&1

ha_star:h2:once:/etc/rc.ha_star >/dev/console 2>&1

hacmp:2:once:/usr/es/sbin/cluster/etc/rc.init >/dev/console 2>&1

自动写的

 

 

 

4.  配置HACMP  以下操作只需在一个节点上操作即可

4.1 配置网络拓朴

4.1.1  配置Cluster Name

       # smitty hacmp                                      

         Extended Configuration                    

     Extended Topology Configuration   

       Configure an HACMP Cluster

         Add/Change/Show an HACMP Cluster  

* Cluster Name              [testcluster]                        

 

4.1.2  配置Cluster节点

      # smitty hacmp                                      

         Extended Configuration                    

     Extended Topology Configuration   

        Configure HACMP Nodes  

                 Add a Node to the HACMP Cluste

                    *NodeName                         [NodeA]   (有意义的名字)               

                     Communication Path to Node          [node1_boot] +

以同样方法将NodeB添加到Cluster

                     *NodeName                        [NodeB]                 

                     Communication Path to Node          [node2_boot] +

 

 

 

 

 

 

Discover配置

#Smitty hacmp

---Extended Configuration

  ---Discover HACMP-related Information from Configured Nodes

  POWERHA 6.1配置文档

 

 

 

4.1.3  配置HACMP网络

4.1.3.1  创建IP网络

      # smitty hacmp                                      

         Extended Configuration                    

           Extended Topology Configuration

             Configure HACMP Networks

                Add a Network to the HACMP Cluster,选择ether

                  * NetworkName                       [net_ether_01]          

* NetworkType                         ether                  

* Netmask                            [255.255.255.0] +

* Enable IP Address Takeover via IP Aliases  [Yes]        +

                    IP Address Offset for Heartbeating over IP Aliases []                      

          * Enable IP Address Takeover via IP Aliases  [Yes]  此选项决定了HACMPIP切换方式,但值得一提的是只有“boot”、“standby”、“service”三个IP分别为三个不同网段时必须选用IP Aliases方式。如果“boot”、“standby”其中一个与“service”为同一个网段时必须选用IP Replace,则此选项应选“NO”。

 

4.1.3.3  创建磁盘心跳网络  

       # smitty hacmp

Extended Configuration                    

           Extended Topology Configuration

Configure HACMP Networks

                Add a Network to the HACMP Cluster,类型选diskhb

* Network Name      [net_diskhb_01]

* Network Type       diskhb         

要将多出的其他磁盘心跳×××,HA6.1建磁盘心跳时,可能会多出2个心跳网络

 

4.1.4  添加网络到Cluster

4.1.4.1  创建IP通信接口

      # smitty hacmp                                      

         Extended Configuration                    

           Extended Topology Configuration

                Configure HACMP Communication Interfaces/Devices

                 Add Communication Interfaces/Device

                  Add Discovered Communication Interface and Devices

                    Communication Interfaces 选择Discovered会自动选中

ALL再按F4逐个选中

                      * IP Label/Address       [node1_boot] +

* Network Type          ether                   

* Network Name         net_ether_01            

* Node Name           [NodeA]    +

                       Network Interface      []

      同样方法添加另一个通信接口到”net_ether_01”

                      * IP Label/Address       [node2_boot] +

* Network Type          ether                   

* Network Name         net_ether_01            

* Node Name           [NodeB]    +

                       Network Interface      []

      同样方法创建另一个通信接口

                      * IP Label/Address       [node1_ stb] +

* Network Type          ether                   

* Network Name         net_ether_01            

* Node Name           [NodeA]    +

                       Network Interface      []

 

                      * IP Label/Address       [node2_ stb] +

* Network Type          ether                   

* Network Name         net_ether_01            

* Node Name           [NodeB]    +

                       Network Interface      []

POWERHA 6.1配置文档

 

 

4.1.4.3  创建磁盘通信设备

       # smitty hacmp                                      

         Extended Configuration                    

           Extended Topology Configuration

               Configure HACMP Communication Interfaces/Devices

                 Add Communication Interfaces/Device

                  Add DiscoveredCommunication Interfaces and Devices

                    Communication Devices

                      * Device Name               [diskhb_node_a]                

* Network Type               diskhb                 

* Network Name              net_diskhb_01          

* Device Path                [/dev/hdisk8]           

* Node Name                [NodeA] +

    同样方法创建另一个磁盘通信设备

                      * Device Name               [diskhb_node_b]                

* Network Type               diskhb                 

* Network Name              net_diskhb_01          

* Device Path                [/dev/hdisk8]           

* Node Name                [NodeB] +

做磁盘心跳的磁盘必须将VG创建为Concurrent模式

POWERHA 6.1配置文档

 

4.2  配置HACMP资源

4.2.1  配置资源

4.2.1.1  创建Applications Servers

        # smitty hacmp                                      

         Extended Configuration                    

       Extended Resource Configuration

             HACMP Extended Resources Configuration

               Configure HACMP Applications Servers

                 Add an Application Server

                   * Server Name          [appserver]          

* Start Script         [/hascript/clstart.sh]

* Stop Script           [/hascript/clstop.sh]

需要先手动在两个节点上建立“/hascript/clstart.sh”、“/hascript/clstop.sh”并保证其有执行权限。如果是双机互备的话需要建立两个App Server。方法相同。

 

4.2.1.2  创建Service IP

        # smitty hacmp                                      

         Extended Configuration                    

       Extended Resource Configuration

             HACMP Extended Resources Configuration

                Configure HACMP Service IP Labels/Addresses

              Add a Service IP Label/Address

Configurable on Multiple Nodes

                  * IP Label/Address                  svc  +

* Network Name                   net_ether_01 

     

 

 

4.2.2  配置资源组

4.2.2.1  创建资源组

 

非并发资源组配置

        # smitty hacmp                                      

         Extended Configuration                    

      Extended Resource Configuration

        HACMP Extended Resource Group Configuration

         Add a Resource Group

* Resource Group Name                    [rg_node_a]             

 Participating Nodes (Default Node Priority)    [NodeA NodeB] +                     

           Startup Policy                 Online On Home Node O> +

           Fallover Policy                Fallover To Next Prio> +

           Fallback Policy                Fallback To Higher Pr> +

 

4.2.2.2  配置资源组属性

        # smitty hacmp                                      

         Extended Configuration                    

       Extended Resource Configuration           

        HACMP Extended Resource Group Configuration

        Change/Show Resources and Attributes for a Resource Group

             Resource Group Name                         rg_node_a              

Participating Nodes (Default Node Priority)        NodeA NodeB            

             Startup Policy                                Online On Home Node O> 

Fallover Policy                               Fallover To Next Prio> 

Fallback Policy                               Fallback To Higher Pr> 

Fallback Timer Policy (empty is immediate)        []+

             Service IP Labels/Addresses                     [node1_svc] +

Application Servers                            [appserver] +

             Volume Groups                               [datavg]+

Use forced varyon of volume groups, if necessary    false+

Automatically Import Volume Groups             ture+

Filesystems (empty is ALL for VGs specified)       []+

Filesystems Consistency Check                  fsck+

Filesystems Recovery Method                   sequential+

Filesystems mounted before IP configured         false+

Filesystems/Directories to Export                []+

Filesystems/Directories to NFS Mount            []                      

Network For NFS Mount                       []+

Tape Resources                               []+

Raw Disk PVIDs                              []+

Fast Connect Services                          []+

Communication Links                          []+

Primary Workload Manager Class                 []+

Secondary Workload Manager Class               []+

 

 

 

 

 

5.  校验并同步HACMP配置

    # smitty hacmp                                      

      Extended Configuration

       Extended Verification and Synchronization

         * Verify, Synchronize or Both                            [Both] +

* Automatically correct errors found during                 [Interactively] +

          verification?                                                              

* Force synchronization if verification fails?                [No] +

* Verify changes only?                                  [No] +

* Logging                                            [Standard] +

 

POWERHA 6.1配置文档

 

HA拓扑:

  Show Cluster Topology

POWERHA 6.1配置文档

 

 

6.  启动/停止HACMP

6.1  启动HACMP(快速路径:#smitty clstart

  # smitty hacmp

    System Management (C-SPOC)

      Manage HACMP Services

        Start Cluster Services

          * Start now, on system restart or both                now                   

            Start Cluster Services on these nodes              [NodeA NodeB]                

* Manage Resource Groups                       Automatically         

  BROADCAST message at startup?                true                  

  Startup Cluster Information Daemon?              false                 

            Ignore verification errors?                       false                 

            Automatically correct errors found during           Interactively         

            cluster start?

POWERHA 6.1配置文档

启动完成后,登陆主节点查看资源

# lsvg -o

datavg

rootvg

 

# l***c -g cluster

Subsystem         Group            PID          Status

 clstrmgrES       cluster          78092        active

 

POWERHA 6.1配置文档

 

 

备节点没挂上datavg和启用service ip

 

 

 

 

6.2  停止HACMP(快速路径:#smitty clstop

  # smitty hacmp

    System Management (C-SPOC)

      Manage HACMP Services

        Stop Cluster Services

          * Stop now, on system restart or both             now+

  Stop Cluster Services on these nodes             [NodeA NodeB] +

  BROADCAST cluster shutdown?               true+

*Select an Action on Resource Groups            Move Resource Groups+

 

POWERHA 6.1配置文档

 

                                                      

7.  测试HACMP(这里仅为模拟测试)

 

7.1、模拟资源从主切到备

#smitty clstop  //主上操作,主的cluster被关闭

POWERHA 6.1配置文档

 

 

再登陆备机,datavg资源起来了,主节点现在看不到

 

如果要切换回主,使用smit clstart启动主的cluster,这时备上的资源切换回主

 

 

7.2、拔网线测试

ifconfig en2 down //模拟主网卡即服务IP所在网卡故障

将主上的主网卡网线拔出,过段时间,服务IP切到主节点的备网卡上

接回网线不切换回来,要手动切

 

 

7.3、模拟主机宕机

主节点执行halt模拟宕机,资源切到备上

主节点起来后,手动起ha,资源自动切回来

转载于:https://blog.51cto.com/12865902/1921972

相关文章: