hacmp学习笔记--请尊重原创 转载时标明出处 谢了

来源:互联网 发布:beyond compare 4 mac 编辑:程序博客网 时间:2024/05/16 07:40

An41教程:

Ha:初始阶段的规划最重要

第一部分:概念和模型

Ha目标:掩盖和消除计划和非计划的宕机

       EliminateSPOF:消除单节点故障,singlepoint of failuare(SPOF)

Cluster:   node可要是设备可是分区

              Node尽量不要在一个机柜

              Node之间一定要有非ip网络,串口,磁盘

RSCT:负责node之间的通讯和协调,发送心跳,监控cluster

clstrmgrES:该工具用来实现HA管理

clcomdcluster nodes间的通信进程 端口6191

LAA local administrated address(本地管理地址),可以给它做一个假的mac地址来进行管理

存储:应支持热插拔和冗余

光纤:普通SAN存储 < 10公里

              HAGU> 10公里

JFSjournal filesystem 日志系统

PowerHA支持两种环境:顺序环境:热备,互备,互备是两个应用的热备

                                          并行环境:RAC

       历史上HA指的是顺序环境版,CMP指的是并行环境版

       普通版叫CM,并行版叫EM

powerHA最多支持的node数量为32

       topology:以网络为中心的物理结构

       resource:可以改变的实体

       resourcegroupresource集合,可以一起切换到另一个node

       推荐配置应用监控

       网卡在教程中都叫做communication interface,串口、心跳磁盘等叫做communication device

       HA每切换一次,系统就要重启一次,典型的宕机时间一般在3分钟左右,最短20S6分钟以上就不能容忍了

       VirtualSCSIVIO SCSI

       目前常见ha版本:5.4 5.4.1 5.5 6.1

       Ha的层次结构:

HACMP

RCST

AIX

LVM

TCP/IP

      

 

时间同步的协议:stpdstmp

 

HA并发卷组:利用锁机制,应用层保证对数据的使用不冲突

Raw:支持数据库的锁机制

FS:不支持锁机制,所以oracle使用锁机制对FS上的数据库操作

 

共享存储:不是HA所必需,而是应用必需

 

Cluster对其节点的要求:

                                   不要求硬件完全相同

性能支持应用

                                   能安装同样的HA版本

                                   安装了同样的os版本

powerHAXD选件用于距离非常远的HA,这种HA使用异步传输

                     plug-ins组件需要另外单独花费200多美元,其内容是很多脚本

                     Smart-assistant组件

                     并发是共享的一个特例

HA要求相关的系统环境不能改变,不能修改环境,否则HA不正常

 

实施前一定要画好规划图,an41侧重于规划和实施,学会规划、安装、管理

Resource group polices:资源组策略包括:

              启动       onlineon home node only模式中住node不启动RG不切换

                            Onlineon first available node 先到先得,也是镜像模式

分布式    哪个node启动,他就拿到RG,但是只拿到属于自己的那组RG,但是并发vg在所有node都有效

powerHA5.4.1开始支持多借点磁盘心跳

              Failover   按照节点列表的顺序,指定下一个接管节点

                            动态切换到下一个node

                            不切换(多node并发-并行模式中,该模式多节点同时对外服务,单个故障不影响集群)

              回切       回到最高的优先级,首先要定义一个回切时间

                            不回切

       现实中的具体情况一般是 先启动数据库,再启动中间件,因为中间件依赖于数据库

IPATip地址接管,就是ip漂移,需要定义的ip serviceIPpersistIP(用于管理)

       同一vlan中所有的ip的子网掩码必需一样

HA需要配置同步的资源:

              应用

              心跳       RSCT控制同步

              节点配置 clcomd控制同步

触发同步的事件:

              网卡失败

              网络失败

              节点失败

 

配置HMC远程管理时 本地IE设置

              选项-高级-关闭TLS1.0      

                            开启SSL2.0

                            开启SSL3.0

Cgi-bin 中的cgi指的是通用网关接口

 

不同类型的心跳ip,服务ip不能在同一网段,否则干扰心跳

HA配置成心跳的ip网络将自动发送心跳

 

如下图所示:如果node11端口网线断了,该如何判断?

现象肯定是两node间的1端口互相不同,这是该如何判断哪个节点网络出问题?

可以实用tcpdump命令

通过node12端口向node21端口发送arp 能收到说明node21口没问题

通过node22端口向node11端口发送arp 不能收到说明node11端口网络问题

说明:

       同一个vlan可以包括不同的子网(网段),其中的每台主机都能收到本vlan其他host发送的arp/ip包,但是不同子网的网卡收到包后丢弃不作回应,所以通过查看另一个节点的网卡是否收到arp包可以确定网卡网络是否正常

       Os本身具有路由功能,127.0.0.1 多网卡同一网段时,会选择本身路由通信。

       同一个node的任何两个网卡不能设置成同一个子网,因为如果在同一个subnet,发包时会从不同的网卡发出,因为两个网卡的路径不同,如果有一个路径出现问题,该网卡将收不到返回包,会有丢包。

       如果是单网卡可以通过配置第三方网卡或文件(netmon.cf)来判断节点失败的原因。

第二部分:存储

共享存储:只允许一个节点修改,其他node不能读也不能写。谁varyonvg谁能操作该存储。

共享存储有两种保护数据不被同时修改的模式:

       Reserve/release标签模式,基于硬件保护(普通共享使用的模式)

       Active/passive模式(HA使用的模式)

       使用清除磁盘disk reserve标记位的命令,该共享存储将得以释放,其他nodevaryonvg改共享 。。。清理锁的标识符:clear ssa

       gsclvmd进程: lv改动时负责在各节点间发送广播,为成员间的通讯提供服务

       JFS:

       JFS2:不支持并发访问,不支持锁机制

node间查看同一个共享存储时可能看到的模式不同:

       Passivevaryon:只能读部分信息,但是不能写

       Activevaryon:可以读写

Concurrent vg=fast vg

 

For avoid split-brain, ip/non-ip 心跳都应该有冗余

当所有的vg都被varyon以后才能对vg进行操作

ConcurrentVG既可以被HA使用也可以当做普通的fs使用

 

bootip是同一个网段的ip是别名ip alias IP

bootip不同一个网段的ipstandbyIP

 

磁盘快速接管:接管速度快,需要安装bos.crvm软件,如果一个node安装了crvm,另一个没装就会看不到

 

Gost-disk概念:普通共享可能会出现“鬼盘”

       当用reserve/release使用共享存储时

B故障,a接管b

B恢复,这时候A占着存储,B找不到属于自己的存储,所以b又自己创建了一次

这时看到两份存储

可以在a上释放存储在b上使用就能解决 b上执行mklv –l

第三部分:HA安装和配置

Pvid:盘序列号最好一致,便于管理

Man rendv 给设备改名

Lazy update :使用enhanced concurrentVG

 

oslevel –s

lsvg rootvg

lsvg –l rootvg

smitty jfs2 – add enhanced JFS            G/fix/4/yes

mount /fix

lslpp –l |grep x.tar

mirrorvg –s rootvg rootvg做镜像

 

uncompress x.tar.z

tar –xvf x.tar

 

bosboot –a

cd cdrom

smit updateadd

bootlist –m normal hdisk1 hdisk0

bootlist –m normal –o

 

concurrentvg需要安装clvm软件

Lslpp –a grep clvm

系统软件不能同时安装

 

clstrmgrES工具在系统启动时自动启动

       more/etc/inittab可以查看,这个工具修改两个nodes之间/usr/es/sbin/cluster/etc/rhosts文件,保持一致并同步

clcomd使用标准的连接认证

       找源ip时,通过/usr/es/sbin/cluster/etc/rhosts文件、找ODM

       clcomdES工具如果环境变量设置成中文会有问题

RSCT: 最多支持32 nodes

RSCT:由心跳拓扑、 组服务 RMC组成

       无论何种心跳,心跳包都走环状拓扑,ip、串口心跳都走环状顺序,按照序号循环

snmpinfo 查询snmp信息

clinfoEScluster information daemonclinfo

 

安装完HAos本身的NFS会出问题,NFS支持锁协议,但是只支持两个nodes

Oslevel –s

smit update_all 软件更新后,提示的最下端会出一个attention提示重启,最好是将系统重启。

安装完clvm以后也需要重启,如果不重启可能出问题

vmo命令可以确定系统是否需要重启:

       1Vmo

       2、查看安装历史

       3、查看启动时间

       4、确定是否重启

HA的补丁最好都先打上,其他的补丁可以先不考虑

 

Ip别名方式
192.168.1.99  p510_boot1

192.168.2.99  p510_boot2

192.168.1.88  p550_boot1

192.168.2.88  p550_boot2

10.1.1.88 srv1

10.1.1.99 srv2

10.1.1.100 srv3

10.1.1.88 p550

10.1.1.99 p510

替换ip模式只支持2serviceIPalias模式可支持多个serviceIP

 

克隆系统的命令:manalt_disk_copy

克隆:按文件比较计算

镜像:按文件系统比较计算,两个osfs应该一致大小

Lsps –a 查看换页空间 /var中存放日志,dump等文件,应该足够大否则有报错就会撑满

/usr/sbin/alt_disk_copy –p all –d hdisk2hdisk3 –OB (可以先终止进程然后用以下命令继续)

ps –ef |grep alt

nohup –p <pid>

alt_disk_install –x altinst_rootvg 删除镜像

 

HAapplication安装顺序可以互换,不一定非要先安装HACMP,如果HA出问题也可以在安装好的系统上卸载并重新安装HACMP

Lssrc –ls clstrmgrES

Iostat

镜像之后修改iphostname即可使用

HA在配置过程中只需要配置一个node然后同步到另一个node即可

       先配拓扑同步

       再配资源同步

       在配置enhanced concurrentVG

       以此类推(我们要配置的双机热备+并发)

Smit HACMP

       c-spoc日常管理选项

       problemdetermination tool 日常问题解决

HA配置步骤如下:

1、 配置hostname ip

2、 创建enhanced concurrentVG

3、 配置通信路径

a)        Clusterànodesà发现网络(第一项)

b)       拓扑à通信接口à自动发现(第五项用于non-IP

c)       Show top

d)       同步(interactive

e)        启动HA(选中两个nodes,单独启动时node也可以同时启动HA不用有先后顺序)

f)        查看ha状态

4、 配置application server name 最好不要大写字母

5、 配置资源,service_name 启停脚本、service_ip

a)        配置服务名

b)       选择启停脚本位置

c)       配置serviceIP

6、 配置存储 c-spoc中配(两个nodes间的共享vg

a)        logicVGàcreate shared VGàcreatea concurrent VG(可以实现快速接管)

7、 配置resource group

a)        选第三个,放在前面的节点是主

b)       启动策略选第4个并发,

c)       Failback都选never

d)       如果改了startup策略也得改第二项选择bring offline

e)        修改属性,选择 serviceIPAPPVG

f)        发现resource Group

8、 配置服务(HA都停掉才能同步)

a)         

9、 配置non-IP网络

a)        磁盘心跳:拓扑àcommunication deviceàdiscover 磁盘心跳占用io很小

b)       查看心跳 clstat 可能会看不到,因为找不到命令路径,/usr/es/sbin/cluster/clstat才可以;more or vi /etc/snmpd3.conf

c)       Stopsrc –s snmpd

d)       Startsrc –s snmpd

e)        查看心跳:cldump /usr/es/sbin/utilities/cldump, 可以把要用的文件路径放到path里;cldump=HACMP里面检测中的第二项

f)        Ls –l | grep ^d (ctrl_d)

10、             同步(启动)

11、             校验配置对不对

a)        cltopinfo :/usr/es/sbin/cluster/cltopinfo

b)       clshowres 查看资源

c)       cldisp 显示动态vip

d)       /usr/bin/snmpinfo/ -n next –vrisc

e)       /usr/es/sbin/cluster/utilities/clcheck_servergrpsvcs|echo $        0表示没启,1表示已启动

f)        lssrc –ls clstrmgrES(vrmf 是版本的意思)

g)       clRGinfo

h)       lssrc –a |grep cl

i)         不要使用HA自带的test工具,日志cluster.log hacmp.out hacmp停掉aix会重启

j)         Lssrc –ls clstrmgrES current stateST_INIT 正在执行,ST_STABLE状态稳定

k)       elfmount 查看FS

12、             如果HA有问题,HA从活动向非活动同步,stable代表状态稳定

删除HA的步骤:

1、 HA

2、 删除nodes(persistIP可以不删)

3、 删除vg

a)        Varyoffvg vg00

b)       Exportvg vg00

c)       Reducevg bvg hdisk2

d)       Lsvg –o

e)        Ls –l /etc/vg

4、 Odm方法删除vg

a)        Odmget –q name=bvg CuDv

b)       Odmdelete –o CuDv –q name=bvg

c)       Odmget –o CuAt –q name=bvg

d)       Odmget –o CuDvDr

5、  

 

Aix各种忘记密码的办法:

       Root:用光盘重新引导

       Asmi

       Sms:抠出电池放电

       串口管理、simi:找到小开关 拨弄一下

       HMC(CA/CElogin):重装HMC、恢复出厂设置、等14天以后自动重设

通过串口可以获得HMC IPHMC先开机再插网线,ip会变成默认,并发资源组不能带IP。最好使用串口连接安装AIX

smit hostname 修改主机名

smit tcp/ipàfuuther configuration(好像是配置persistIP)

lssrc –s sshd

cfgmgr –l scsi2

cfgmgr

lsdev –Cc disk

bootinfo –s hdisk2 查看磁盘的大小

rmdev –dl hdisk2 删除磁盘

HAnode名可以和host名不一样,但最好是一样

HAsmit建立节点连接的时候,选一个网卡资源就行

       Addinterface/device à adddiscovered连接接口和设备

persistIP 用来管理:(主要用于平时的管理,路由配置、ip不能漂移到另一个node、校验同步,在“interactive”选择中配置)

       ssa

       disk心跳(enhanced concurrentVG

       串口心跳

       校验和同步

persistIP可路由,监控程序、监视目前是安全的cluster

gsclvmd 随着HA启动而启动,单独停止再启动启不来

grpglsm 用来监控,sp做切换时使用,平时不启动

netstat –i 查看启动端口

chmod 700 *

 

报错HACMPsiteinfo

/etc/es/objrepos/HACMPsiteinfo 这是没有pvid的原因

授予pvid       chdev –l hdisk2 –a pv=yes

Machinfo 查看cpu

 

改变0,0 à33,24

同步频率60à10

改变ssa节点号0à1,

0à2

 

Smit clstart 启动ha

Lssrc –ls clstrmgrES

Netstat –i

查看路由:netstat –rn

              Ping–R

Cllsif 查看接口

Crfindres

Clshowsrv –v-a

Odmget HACMPlogs 查看日志菜单

查看历史操作:history| .sh_history | wtmp

Ifconfig en1 10.1.1.1delete

Lqueryvg –p hdisk4 –At | more

Redefinevg –d hdisk4 bvg     Redefinevg –d hdisk4

Cd /dev/         ls–l | grep vg

Odmget CuDvDr |grep –p bvg

Ls –l |grep 48,

Odmget CuAt | grep pvid

Odmget CuAt|grep –p pvid

Shutdown –Fr

Odmdelete –o CuDvDr –q value=bvg

 

第四部分:ip替换方式配置HA

相比于别名方式,ip替换方式支持mac接管,这是ip替换方式的唯一优点

serviceIP启动以后替换bootIP

一个网卡只能有一个ServiceIP

一个网卡对应一个ip,有多少个网卡就有多少个iP

所有serviceIPbootip都应该在同一个子网

最多只支持2serviceIP,且必须在同一个子网

当网卡的HA故障检测需要配置第三方节点,即netmountcf文件

 

常见的ip配置错误:

       子网掩码不同

       一个node上的ip都在同一subnet

       放在同一subnet

       网口速率最好指定,不要自动

       /etc/host文件不同

 

Ip地址漂移对client的影响:

       同一node上的en1飘到了en2

       Gratuitousapp广发消息包,但是有些路由不支持,因为一旦是欺骗包将导致以后不能正常通信

      

Ip –d 删除ip (在客户端执行)

Arp –d ip

Ping –c 4 ipip表里没有)

       这时可以更新ip列表

如果遇到ipcache问题可以实用假mac方式解决

Smitàdeviceàcommunicationà addà 合并

 

有多种检测方式可以检测总体情况:

规划应用监控:进程监控、定制监控

Hacmp es cluster manage包含

       Run_clappmond

       Clappmond

定制监控:服务可用、不可用

Ps –l <process_name>

Ps –e 显示其他

一个app可以有多个monitor,一个cluster最多有48monitor

 

Ip别名方式换成ip替换方式,persistIP需要先删掉

Snapshot用来备份ha配置信息,还原配置信息,也可以存储配置信息

 

DARE:动态重分配

       Clustertoplogy

       运行DARE需要三种odm copies DCD/SCD/ACD在同步过程中使用

单节点控制:

       做改变之前,建议先做snapshot,改变vgda其实是改变odmgpfs需要单独买软件

Esc+9切换到另一个node

配置ha过程中一定要把vg加入到resourceVG

Snap –e

Netmon –cf

Clsnap –a

Lvm问题原因,基本上是改变和odm不一致造成,手工改变lvm就行

a上改口令,突然切到了b上,b上还是老口令

Link to 。。。

Home目录下不妨共享文件

使用集群修改口令,如果A改动,那么自动同步到b,如果某node关闭,就需要将cluster改成single模式

如果HA版本不一致,包括补丁,可以校验但不要同步,否则odm会垮掉

如果某个node 非活,那么该节点不能发起同步

 

每日巡检:

       校验:配置和env是否匹配

       先不要同步,先校验

       如果想回滚操作可以用snapshot还原

测试串口心跳:

       两个节点都执行stty</dev/tty0

       也可以在一个节点执行 cal>/dev/tty0 另一个执行 cat</dev/tty0

       测心跳应该双方向

c-spoc 选项用来添加删除可以,但是改变不可以

home node模式不是并发

netmon.cf用来配置单网卡cluster第三方校验

ls –l |grep ^d

事件目录:/usr/es/sbin/cluster/events

       Ls|grep–v rp|wc –l

       Ls–l |grep –v rp|grep down

网络故障是fail不是down

使用smit中的文件名最好不带空格

打完补丁就会自动改脚本,所以打完补丁需要改动脚本

添加事件实际就是启用

停掉cluster服务,clmond先是停掉在重启,修改事件记录再重启cluster

建立资源时不应该让vg自动varyon

模拟错误日志:

       Errpt|head

Detail send data 什么都没有说明是模拟

       如果有二进制数说明有问题

Ha的自动校验是默认每晚12点,生产环境中testtool不要用

 

Led显示888,

原因:可能是dms超时(dead man swich死人开关)

       Cluster在每个node都有心跳的计数,达到一定数值会自动复位,如果磁盘io太大,cluster不让计数及时复位,不复位node就不能发出心跳,节点间会互相认为对方故障,出现split-brain

       DGSP原理:一个节点正在正常运行资源,另一个资源来接管(抢),cluster会中断资源数少的node,保证数据完整,网络不混乱

Dms产生的原因:

       没有心跳网络和通信网络

       切换太快

Dms是不允许停掉的。要想改变dms报错,

只能扩展配置,

把心跳率变低

Syncd 60秒把磁盘上的东西写到磁盘,如果时间变短一点io也会变得少一点,就能减少dms几率

把系统级别的改成3324

Src中断会导致死机

Src意外中断、kill -9等原因

没打补丁修复bug

会导致关机或死机

Src不能意外终止否则会死机

两个节点,拔掉线之后马上插上,节点也会down(有丢包了认为对方down,又通了说明有未知问题,为了保护数据down掉自己)

问题定位采用少数节点服从多数节点原则

2节点可能是名字顺序

如果意外宕机将先记录关机日志,在记录错误日志,注意时间顺序

RG事件再加180秒,错误往前推

Snap –c 收集ha日志

http://www.aixchina.net/home/space.php?uid=6880&do=blog&id=24175

Death man swich

The DGSP message
A Diagnostic Group Shutdown Partition (DGSP) message is sent when a node losescommunication with the cluster and then tries to re-establish communication.
214 IBM ^ Certification Study Guide - pSeries HACMP for AIX
For example, if a cluster node becomes unable to communicate with other nodes,yet it continues to work through its process table, the other nodes conclude thatthe “missing” node has failed because they no longer are receiving keepalivemessages from it. The remaining nodes then process the necessary events toacquire the disks, IP addresses, and other resources from the “missing” node.This attempt to take over resources results in the dual-attached disksreceiving resets to release them from the “missing” node and the start of IP addresstakeover scripts.
As the disks are being acquired by the takeover node (or after the disks have beenacquired and applications are running), the “missing” node completes its processtable (or clears an application problem) and attempts to resend keepalivemessages and rejoin the cluster. Since the disks and IP addresses are in theprocess of being successfully taken over, it becomes possible to have a duplicateIP address on the network and the disks may start to experience extraneoustraffic on the data bus.
Because the reason for the “missing” node remains undetermined, you can assumethat the problem may repeat itself later, causing additional down time of notonly the node but also the cluster and its applications. Thus, to ensure the highestcluster availability, a DGSP message is sent to all nodes in one of the partitions.Any node receiving a DGSP message halts immediately, in order to not cause anydamage on disks or confusion on the networks.

In a partitioned cluster situation, the smallerpartition (lesser number of nodes) is shut down, with each of its nodes gettinga DGSP message. If the partitions are of equal size, the one with the node namebeginning in the lowest name in the alphabet gets shut down. For example, in acluster where one partition has NodeA and the other has NodeB, NodeB will beshut down.

 

Deadman switch

To ensure a clean takeover, HACMPprovides a Deadman Switch, which is configured to halt the unresponsive nodeone second before the other nodes begin processing a node failure event. TheDeadman Switch uses the Failure Detection Parameters of the slowest network todetermine at what point to halt the node. Thus, by increasing the amount oftime before a failure is detected, you give a node more time in which to giveHACMP CPU cycles. This can be critical if the node experiences saturation attimes.
To help eliminate node saturation, modify AIX 5L tuning parameters. For information about thesetuning parameters, see the following sections in the Administration Guide:
•Configuring Cluster Performance Tuning in Chapter 18: Troubleshooting HACMPClusters
•Changing the Failure Detection Rate of a Network Module in Chapter 12:Managing the Cluster Topology.
Change Failure Detection Parameters only after these other measures have beenimplemented.

Syncd Frequency
The syncd setting determines the frequency with which the I/O disk-writebuffers are flushed. Frequent flushing of these buffers reduces the chance ofdeadman switch time-outs.
The AIX 5L default value forsyncd as set in /sbin/rc.boot is 60. Change this value to 10. Note that the I/Opacing parameter setting should be changed first. You do not need to adjustthis parameter again unless time-outs frequently occur.

 

Ha非常重要的几个概念:

     Gost-disk

     Split-brain

     Deadmanswich

     DGSP

原创粉丝点击