AIX系统维护手册二.双机配置,HACMP

来源:互联网 发布:淘宝上买东西怎样付款 编辑:程序博客网 时间:2024/05/01 21:42

二.双机配置,HACMP

配置hacmp的一些注意事项:
1. 安装的版本要符合数据中心的版本策略要求
2. 安装前要做好规划,了解应用要实现什么样的高可靠性需求
3. HA可以实现排除单点故障,但不是冗余,因此关键部件还要有冗余配置,如电源模块、双HBA卡、rootvg镜像等
4. 配置为HA的主、备节点不能是同一台物理服务器上的两个逻辑分区
5. 存储厂商在HA环境下有定制的磁盘解锁脚本,EMC、HDS存储,在ha的event事件中增加厂商自定义脚本。
6. 编写的应用启停脚本要事先手工执行测试,并且确保停止脚本在系统异常时也可以停止应用,以释放资源。
7. HA配置完成后,不要将ha的服务设置为自启动模式,即ha服务的启动,要手工启动
8. HA配置完成后,要模拟各种故障场景,充分测试接管功能是否正常。
9.  boot地址和service地址必须都在不同网段,才能使用IP alias(别名方式)。

HACMP 规划
在配置ha前先要做好规划工作,规划的内容包括以下几点:
1、 了解应用要实现什么样的高可靠性
2、 规划cluster拓扑结构
3、 集群的网络连接
4、 共享的DISK、LVM
5、 规划资源组
6、 集群中节点的用户、组ID要一致

2.1 HA(High Availability)
什么是高可用 (High Availability)
1、 Regardless if the down time is planned or unplanned down time
2、 High Availability is done by eliminating of single points of failure
3、 High Availability is fault resilient not fault tolerant
HA常见的部署模式有主备模式、互备模式、concurrent模式等

ha的failover切换动作可以有如下图所示的几种切换方式。
 
2.2 双机规划
本文档是以两个节点的hacmp主、备基本模式的环境作为例子进行编写,一个资源组两个服务IP,分别是对上和对下地址。
本例中,单个资源组,两个服务ip,两个不同网段的服务IP必须在同节点运行,断掉任何一个都要双机自动切换,由于两个service IP不在同一网段,也不能在同一VLAN,所以两个service IP不能在一个网口,如果在一个网口,漂移过来的service IP无法访问,并且双机不会切换,所以需要两个组网ether1,ether2。
其他如双机互备,也需要两个组网,service IP分不同节点运行。

boot IP分配规则如下:

    

GUAP0200

GUAP02000

bdeap1boot1

200.68.4.175

bdeap2boot1

200.68.4.17

bdeap1boot2

200.68.5.175

bdeap2boot2

200.68.5.177

bdeap1boot3

200.68.6.176

bdeap2boot3

200.68.6.178

bdeap1boot4

200.68.7.176

bdeap2boot4

200.68.7.178

 

拓扑规划

资源组划分

Res.  Grp. Name

Node  Rel.

Part. Node Name

bdeap1res

Cascading

GUAP0200, GUAP02000

 

 

建立app应用服务器

App  Name

Start  Script

Stop  Script

bdeap1app

/hacmp/bdeap1appstart.sh

/hacmp/bdeap1appstop.sh

 

配置资源组

Res.  Grp. Name

Service  IP

Filesystems

Volume  Group

Application  Servers

bdeap1res

bdeap1svc1

 

appvg01

bdeap1app

bdeap1res

bdeap1svc2

 

appvg01

bdeap1app

 

资源组切换模式

Startup Policy

Online On Home Node Only

Fallover Policy

Fallover To Next Priority Node In The List

Fallback Policy

Never Fallback

 

 

3、HACMP 安装前准备
3.1、硬件环境准备
在安装HA 软件之前,首先连接好系统外接硬件设备
1、TCP/IP网络连接,生产网卡与备份网卡的网线需要连接到不同的网络交换机
2、点对点网络心跳线的连接,我们在这里使用rs232串口作为心跳线
3、外接存储设备连接,HBA卡要连接到不同的SAN交换机,并且安装存储厂商的多路径软件,以实现光纤链路的冗余。

3.2、网络环境准备
在配置HACMP时,需要考虑一些必要的网络因素,尤其是配置了交换机的网络,否则将严重影响HACMP的稳定运行.
1、VLAN:
在HACMP中,定义在一个"cluster network"内的几个网络接口,必须配置在同一个VLAN中(即一个network对应一个VLAN),并且定义在同一个network中的接口之间,要确保相互ping的通.
2、自适应设置:
很多网络适配器都有自适应的功能: 自适应速率和其他网络属性,例如半双工或者全双工.在HACMP环境里,不建议网卡使用自适应功能,而推荐设置成固定速率和全双工方式.同时,与这些网卡相连接的交换机端口,同样设置成固定速率和全双工方式.
3、ARP设置:
目前一些网络交换机可以设置APR回应方式: 或者延迟ARP,或者使用代理ARP(proxy ARP).而这些设置都会影响网络的稳定性,触发不可预知的网络问题. 在HACMP环境里,建议关闭这些ARP设置;如果不能关闭,那么请确保交换机能提供及时、正确的ARP回应包.此外,某些品牌交换机的如下属性也建议关闭: 'spanning tree algorithm','portfast','uplinkfast','backbonefast'.(如果'spanning tree algorithm'一定要打开,请同时打开'portfast'属性.)

3.3 介质准备
介质准备包括hacmp基本包的安装介质,补丁包的准备,补丁包可以从IBM官方网站下载,
链接地址访问 http://www-912.ibm.com/eserver/support/fixes/fixcentral


4 PowerHA(HACMP) 软件安装
IBM现在将HACMP名称更改为PowerHA,安装软件时需要注意,配置在Cluster集群中的每台服务器节点,要求其上安装的操作系统的版本及补丁级别保持一致、hacmp软件的版本及补丁级别保持一致。
4.1、安装hacmp6.1需要的操作系统软件包
1、 操作系统需要安装的基本软件包
AIX BOS Component AIX v6.1 AIX v5.3
bos.adt.lib 6.1.2.0 5.3.0.1
bos.adt.libm 6.1.2.0 5.3.0.1
bos.adt.syscalls 6.1.2.0 5.3.7.0
bos.net.tcp.client 6.1.2.0 5.3.7.3
bos.net.tcp.server 6.1.2.0 5.3.7.3
bos.rte.SRC 6.1.2.0 5.3.7.3
bos.rte.libc 6.1.2.0 5.3.7.5
bos.rte.libcfg 6.1.2.0 5.3.7.0
bos.rte.libcur 6.1.2.0 5.3.7.0
bos.rte.libpthreads 6.1.2.0 5.3.7.2
bos.rte.odm 6.1.2.0 5.3.7.0
bos.rte.lvm (required only using Concurrent Logical Volume Manager for concurrent access) 6.1.2.0 5.3.7.2
bos.clvm.enh (required only using Concurrent Logical Volume Manager for concurrent access) 6.1.2.0 5.3.7.2

2、需要的RSCT软件包
Rsct软件包到介质库下载对应操作系统版本的最新的软件包。
 

4.2、更新操作系统
AIX操作系统及其上的软件按照数据中心的版本策略要求将版本更新到相应的级别,BDE对操作系统的要求是:
操作系统版本要求
AIX 7100-02-SP4
AIX 6100-SP12
使用下面的命令查看:
# oslevel –s
#lslpp –l|grep rsct
# lppchk -v
4.3 hacmp软件安装
安装hacmp软件前,确保/usr、/ 根文件系统目录有足够的Free空间,要求Free空间大于180MB,将hacmp6.1的光盘介质放入光驱。
#smit installp
 
选择软件包,不用选择cluster.doc.en_US.assist、cluster.doc.en_US.es、cluster.es.plugins、cluster.es.worksheets、cluster.hativoli软件包

4.4、升级hacmp软件
4.4.1、下载ha补丁
从http://www-912.ibm.com/eserver/support/fixes/fixcentral

 
将最新的补丁包下载到本地,并以二进制格式上传到服务器/home/backupfile/tmp目录下。
4.4.2 升级hacmp补丁包
本文示例是将PowerHA6.1升级到PowerHA 6.1SP12的补丁级别。
#smit update_all方式安装补丁
 
安装完成后利用lslpp –l |grep cluster.es.server.rte 查看补丁是否已升级成功,
 
升级后重新引导操作系统,使升级生效。

5、配置hacmp
配置规划表
Local Node GUAP0200
Takeover (Remote) Node GUAP02000
Application Server bdeap1app
Application Start Script /hacmp/ bdeap1appstart.sh
Application Stop Script /hacmp/ bdeap1appstopt.sh
Service IP Label bdeap1svc1,bdeap1svc2

5.1、设置IP地址
1、编辑 /etc/hosts文件,两台服务器的主机名分别为bdeap1、bdeap2
# For HACMP
#Service IP labels
68.0.40.210 bdeap1svc1
68.0.63.180 bdeap1svc2

#GUAP0200 node
200.68.4.175  bdeap1boot1
200.68.5.175 bdeap1boot2
200.68.6.176    bdeap1boot3
200.68.7.176    bdeap1boot4

#GUAP02000 node
200.68.4.177  bdeap2boot1
200.68.5.177  bdeap2boot2
200.68.6.178    bdeap2boot3
200.68.7.178    bdeap2boot4

68.0.63.180     GUAP0200
68.0.63.181     GUAP0210


注意:
Boot     IP:  所有boot IP都不能在同一网段。如果要同一网段,在创建组网时,需要Enable IP Address Takeover via IP Aliases  为no。否则,ping boot IP会丢包甚至不通。
Standby  IP:  这里Standby IP与boot IP不在同一网段,使用主机IP
编辑/usr/es/sbin/cluster/etc/rhosts文件,增加信任关系
bdeap1svc1
bdeap1svc2
bdeap1boot1
bdeap1boot2
bdeap1boot3
bdeap1boot4
bdeap2boot1
bdeap2boot2
bdeap2boot3
bdeap2boot4

GUAP0200
GUAP0210

 

 

2、为每台服务器配置IP地址,配置上所有的boot地址,service IP不用配置。
# smit chinet

5.2、配置共享磁盘卷组VG
注意,创建卷组时需要手工指定卷组的Major Number号,以免在两台服务器之间发生冲突,使用-S参数设置卷组的类型。
1、bdeap1节点上执行
在bdeap1服务器上创建appvg01卷组
# mkvg -S -V 100 -s 256 -y appvg01 hdisk4 hdisk5 hdisk6 hdisk7 hdisk8
# chvg –an appvg01  (卷组去掉自动激活选项)
# varyoffvg appvg01

2、bdeap2节点上执行,倒入卷组,导入前如果PV没有PVID,请将所有成员盘生成PVID
#chdev -l hdisk4 -a pv=yes
# importvg –V 100 –y appvg01 hdisk4
# chvg –an appvg01
# varyoffvg appvg01
5.3、定义tty串口通讯设备
5.3.1、增加tty设备
smit tty
  Add a TTY
    tty rs232 Asynchronous Terminal
定义tty属性
 
 BAUD rate 9600


创建成功后,
 #lsdev -Cc tty
 tty0
 
5.3.2 tty通讯测试
两台服务器的心跳设备tty配置完成后,需要测试tty通讯是否正常,测试方法:
1、在bdeap1上执行:
bdeap1#cat /etc/hosts >/dev/tty0
bdeap2#cat < /dev/tty0
如果bdeap2屏幕上输出/etc/hosts表内容,表明bdeap1到bdeap2的通讯正常

2、在bdeap2上执行:
bdeap2#cat /etc/hosts >/dev/tty0
bdeap1#cat < /dev/tty0
如果bdeap1屏幕上输出/etc/hosts表内容,表明bdeap2到bdeap1的通讯正常


6 创建集群Cluster
6.1 配置网络拓朴
6.1.1  配置Cluster Name
       # smitty hacmp                                      
         Extended Configuration                    
           Extended Topology Configuration   
             Configure an HACMP Cluster
               Add/Change/Show an HACMP Cluster 
* Cluster Name              [bdeapcl]                        
6.1.2  配置Cluster节点
      # smitty hacmp                                      
         Extended Configuration                    
            Extended Topology Configuration   
               Configure HACMP Nodes  
                 Add a Node to the HACMP Cluste
                    *NodeName                         [GUAP0200]                 
                     Communication Path to Node          [GUAP0200] +
以同样方法将GUAP0210添加到Cluster中
                     *NodeName                        [GUAP0210]                 
                     Communication Path to Node          [GUAP0210] +

注:
6.1.3  配置HACMP网络
6.1.3.1  创建IP网络
      # smitty hacmp                                      
         Extended Configuration                    
           Extended Topology Configuration
             Configure HACMP Networks
                Add a Network to the HACMP Cluster
                  * NetworkName                       [ether1]          
* NetworkType                         ether                  
* Netmask                            [255.255.255.0] +
* Enable IP Address Takeover via IP Aliases  [Yes]        +
 IP Address Offset for Heartbeating over IP Aliases []                      
 使用同样的方法创建[ether2]
      * Enable IP Address Takeover via IP Aliases  [Yes]  此选项决定了HACMP的IP切换方式,但值得一提的是只有“boot”、“standby”、“service”三个IP分别为三个不同网段时必须选用IP Aliases方式。如果“boot”、“standby”其中一个与“service”为同一个网段时必须选用IP Replace,则此选项应选“NO”。
6.1.3.2  创建串口心跳网络
      # smitty hacmp                                      
         Extended Configuration                    
           Extended Topology Configuration
             Configure HACMP Networks
                Add a Network to the HACMP Cluster
* NetworkName                [rs1]
* Network Type                 rs232 
       
6.1.4  添加网络到Cluster
6.1.4.1  创建IP通信接口
      # smitty hacmp                                      
         Extended Configuration                    
           Extended Topology Configuration
             Configure HACMP Networks
               Configure HACMP Communication Interfaces/Devices
                 Add Communication Interfaces/Device
                   Add Pre-defined Communication Interfaces and Devices
                    Communication Interfaces
* IP Label/Address       [bdeap1boot1] +
* Network Type          ether                   
* Network Name         ether1            
* Node Name           [GUAP0200]    +
Network Interface      [en4]
      同样方法添加另一个通信接口到”ether1”
* IP Label/Address       [bdeap2boot1] +
* Network Type          ether                   
* Network Name         ether1            
* Node Name           [GUAP0210]    +
Network Interface      [en4]
      同样方法创建另一个通信接口
* IP Label/Address       [bdeap1boot2] +
* Network Type          ether                   
* Network Name         ether1            
* Node Name           [GUAP0200]    +
Network Interface      [en8]

* IP Label/Address       [bdeap2boot2] +
* Network Type          ether                   
* Network Name         ether1            
* Node Name           [GUAP0210]    +
Network Interface      [en8]

      同样方法添加另一个通信接口到”ether2”
* IP Label/Address       [bdeap2boot3] +
* Network Type          ether                   
* Network Name         ether2           
* Node Name           [GUAP0210]    +
                       Network Interface      [en4]

* IP Label/Address       [bdeap2boot3] +
* Network Type          ether                   
* Network Name         ether2           
* Node Name           [GUAP0210]    +
                       Network Interface      [en4]
      同样方法创建另一个通信接口
* IP Label/Address       [bdeap1boot4] +
* Network Type          ether                   
* Network Name         ether2           
* Node Name           [GUAP0200]    +
                       Network Interface      [en8]

* IP Label/Address       [bdeap2boot4] +
* Network Type          ether                   
* Network Name         ether2           
* Node Name           [GUAP0210]    +
                       Network Interface      [en8]
6.1.4.2  创建串口通信设备
      # smitty hacmp                                      
         Extended Configuration                    
           Extended Topology Configuration
             Configure HACMP Networks
               Configure HACMP Communication Interfaces/Devices
                 Add Communication Interfaces/Device
                   Add Pre-defined Communication Interfaces and Devices
                    Communication Devices
* Device Name           [bdeap1tty]          
* Network Type           rs232                  
* Network Name          rs1           
* Device Path            [/dev/tty0]             
* Node Name            [GUAP0200]    +
      以同样方法创建另一个串口通信设备
* Device Name           [bdeap2tty]          
* Network Type           rs232                  
* Network Name          rs1           
* Device Path            [/dev/tty0]             
* Node Name            [GUAP0210]    +

6.2 配置HACMP资源
6.2.1  配置资源
6.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。方法相同。
6.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                  bdeap1svc1   +
* Network Name                   ether1 
      同样方法配置第二个Service IP
* IP Label/Address                  bdeap1svc2   +
* Network Name                   ether2 
      Network Name:“ether1”、“ ether2” 决定了与之对应的Service IP默认在哪个网卡上启动。这样配置之后,svc1会在ether1的en4和en8上启动,en4为主。svc2会在ether2的en6和en9上启动,en6为主
6.2.2  配置资源组
6.2.2.1  创建资源组
        # smitty hacmp                                      
            Extended Configuration                    
               Extended Resource Configuration
                 Add a Resource Group
* Resource Group Name                    [bdeap1res]             
 Participating Nodes (Default Node Priority)    [GUAP0200 GUAP0210] +                     
           Startup Policy                 Online On Home Node O> +
           Fallover Policy                Fallover To Next Prio> +
           Fallback Policy                Fallback To Higher Pr> +
 “Participating Nodes”选项决定了资源组中节点的优先级,写在前面的节点其优先级高于后面的节点。
 根据实际需求决定资源组的:“Startup Policy”、“Fallover Policy”、“Fallback Policy”。
 Startup Policy:
Online On Home Node Only: 只在主节点启动。在 “Participating Nodes”中写在第一位的节点启动。
Online On First Available Node:在第一个启动的节点启动。在“Participating Nodes”中所选择的所有节点中最先启动的节点上启动。
Online Using Distribution Policy:按照分布策略启动
Online On All Available Nodes:在所有启动的节点中启动。做并发群集时选择此项。如:Oracle RAC
      Fallover Policy:
Fallover To Next Priority Node In The List:节点失败时资源组迁移到下一优先级节点
Fallover Using Dynamic Node Priority:节点失败时动态选择迁移节点
Bring Offline (On Error Node Only):将资源组下线
      Fallback Policy:
Fallback To Higher Priority Node In The List:节点恢复时资源组返回优先级高的节点
Never Fallback:不进行资源组回迁
6.2.2.2  配置资源组属性
        # smitty hacmp                                      
          Extended Configuration                    
            Extended Resource Configuration
              Change/Show Resources and Attributes for a Resource Group
 Resource Group Name                         rg_node_a              
Participating Nodes (Default Node Priority)        GUAP0200 GUAP0210            
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                     [BDEAP1svc] +
Application Servers                            [appserver] +
Volume Groups                               [appvg01]+
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] +
7 启动/停止HACMP
7.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              [GUAP0200 GUAP0210]                
* Manage Resource Groups                       Automatically         
  BROADCAST message at startup?                true                  
  Startup Cluster Information Daemon?              false                 
            Ignore verification errors?                       falsbe                 
            Automatically correct errors found during           Interactively         
            cluster start?    
7.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             [GUAP0200 GUAP0210] +
  BROADCAST cluster shutdown?               true+
*Select an Action on Resource Groups            Move Resource Groups+
                                                      


8 切换测试
8.1 手工停服务切换测试
节点GUAP0200服务器上执行,take over
切换前资源组Resource Group: ocrdb1res  On line在bdeap1服务器上。
smit clstop  (选择Move Resource Groups)
 
回车,并跟踪ha的切换日志,
# tail –f /tmp/hacmp.out
待切换完成后资源组Resource Group: ocrdb1res  On line在bdeap2服务器上。登陆bdeap2检查service ip地址及appvg01卷组状态。
 
8.2 不停ha服务,在线移动资源组(C-SPOC)
 
选择move资源组
 
选择要移动的资源组
 
选择目标节点
 
回车确认后,资源组会切换到bdeap2节点上。
8.3 模拟网卡故障测试
测试步骤包括,bdeap1节点上操作:
1. 模拟主网卡故障,将主网卡的网线拔掉service ip会漂移到本节点的standby 网卡上
2. 插上故障网卡的网线,不会发生切换动作,ha会报一个网卡up信息
3. 将备份网卡上的网线拔掉,service ip 会漂移回到主网卡上
4. 再拔掉主网卡上的网线,此时bdeap1上的主备网线均拔掉,资源组ocrdb1res会切换到备机bdeap2节点上,并且ip地址漂移到bdeap2的standby 网卡上

 

8.4 手工单节点主备网卡切换测试(VIP切换)
对于IP替换方式的网络配置,需要使用下面方法进行单节点主备网卡切换
测试步骤包括,在service ip所在节点上操作:
1、 登录smit
->System Management (C-SPOC)
->Communication Interface
->Swap IP Addresses Between Communication Interfaces
选择需要切换的service ip和网络:
 
选择要切换到的目标网络接口和网络:
 
确认上述选择内容,并回车执行:
 
切换完成后,使用ifconfig –a命令查看是否切换成功。
注意:不能使用#ifconfig enX down命令(别名方式可以)
8.5 模拟服务器异常down机测试
模拟bdeap1 down机测试,在bdeap1节点上执行
# halt –q
bdeap1会立即down机,资源组应该切换到备份节点bdeap2服务器上。

0 0
原创粉丝点击