mxin辛旻
作者mxin辛旻2014-02-20 12:56
资深工程师, 上海宝信软件股份有限公司

PowerHA完全手册(二)

字数 91695阅读 7343评论 5赞 1
第二部分--安装配置篇2.1. 准备2.1.1. 安装前提 1) 操作系统版本要求:

实验实际为AIX6.1.10,实际HACMP6.1 要求AIX5.3.9和AIX6.1.2,具体安装时可查看以下安装版本的《High Availability Cluster Multi-Processing for AIX   Installation Guide》Prerequisites一节。

 

 

 

2) 系统参数要求

   作为集群的各个节点机,我们建议各个参数最好完全一致,需要注意的参数有:

1. 异步I/O 服务进程配置(Asynchronous I/O servers)

2. 用户最大进程数

3. 系统时间

4. 用户缺省的limits参数

5. 其他可能影响应用的参数  

3) 环境要求

   此时,没有建立任何HACMP占用设计ID相关用户和组,同样也没有建立VG和文件系统,包括名称冲突文件系统和lv和Major numver冲突的VG。

Ø 用户和组确认

目的:确认没有和设计中ID冲突的用户,否则需要调整。

 [host1][root][/]lsuser -a id  ALL

 

root id=0

daemon id=1

bin id=2

sys id=3

adm id=4

uucp id=5

……

[host2][root][/]>lsuser -a id ALL

root id=0

daemon id=1

……

Ø 文件系统确认

  目的:确认没有和设计名称相冲突的文件系统,否则需要调整。

 [host1][root][/]>df -k

Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4           524288    487820    7%     3276     3% /

/dev/hd2          7077888   1868516   74%    91290    18% /usr

/dev/hd9var        524288    458364   13%      991     1% /var

/dev/hd3           917504    826700   10%      120     1% /tmp

/dev/hd1           655360    524856   20%      291     1% /home

/proc                   -         -    -         -     -  /proc

/dev/hd10opt      1179648    589072   51%    11370     8% /opt

 [host2][root][/]>df -k 

 …..

 

 

4) 安装包要求:

RSCT 3.1.2.0 或更高版本。lslpp -l|grep rsct 

以下的包也是必须要安装的:(脚本可直接拷贝运行)

lslpp  -l  rsct.*

lslpp  -l  bos.adt.lib

lslpp  -l  bos.adt.libm

lslpp  -l  bos.adt.syscalls 

lslpp  -l  bos.net.tcp.client 

lslpp  -l  bos.net.tcp.server

lslpp  -l  bos.rte.SRC

lslpp  -l  bos.rte.libc

lslpp  -l  bos.rte.libcfg 

lslpp  -l  bos.rte.libcur

lslpp  -l  bos.rte.libpthreads 

lslpp  -l  bos.rte.odm

显示确认结果:

[host1][root][/]>lslpp  -l  rsct.*

  Fileset                      Level  State      Description         

  ----------------------------------------------------------------------------

Path: /usr/lib/objrepos

  rsct.basic.hacmp           3.1.2.0  COMMITTED  RSCT Basic Function (HACMP/ES

                                                 Support)

  rsct.basic.rte             3.1.2.0  COMMITTED  RSCT Basic Function

  rsct.basic.sp              3.1.2.0  COMMITTED  RSCT Basic Function (PSSP

                                                 Support)

  rsct.compat.basic.hacmp    3.1.2.0  COMMITTED  RSCT Event Management Basic

                                                 Function (HACMP/ES Support)

  rsct.compat.basic.rte      3.1.2.0  COMMITTED  RSCT Event Management Basic

                                                 Function

  rsct.compat.basic.sp       3.1.2.0  COMMITTED  RSCT Event Management Basic

                                                 Function (PSSP Support)

  rsct.compat.clients.hacmp  3.1.2.0  COMMITTED  RSCT Event Management Client

                                                 Function (HACMP/ES Support)

[host2][root][/]>lslpp  -l  rsct.*

……

 

2.1. 
安装2.1.1. 安装PowerHA6.1(需要在所有节点上安装)

如果是光盘,请插入光盘 ,输入smitty install_latest

                                Install Software

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                              [Entry Fields]

* INPUT device / directory for software               /dev/cd0

* SOFTWARE to install                           [_all_latest]

…..                                                                       

  ACCEPT new license agreements?                      yes                                                                         

Preview new LICENSE agreements?                     no  

如果是安装盘拷贝,请进入cd installp/ppc目录,smitty install_latest

     Install Software

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                              [Entry Fields]

* INPUT device / directory for software               .

* SOFTWARE to install                           [_all_latest]

…..

  ACCEPT new license agreements?                      yes                                                                         

Preview new LICENSE agreements?                     no

安装结束后,会报failed,请检查

cluster.doc.en_US.pprc.pdf 

cluster.es.cgpprc.rte 

cluster.es.pprc.cmds 

cluster.es.spprc.*

cluster.es.sr.*

cluster.es.svcpprc.*

cluster.xd.*

glvm.rpv.*

包以外,所有的HACMP的包都要安装  

2.1.2. 打补丁

       注意,请不要忽略给HACMP打补丁这一步骤。其实对HACMP来说,补丁是十分重要的。很多发现的缺陷都已经在补丁中被解决了。当严格的按照正确步骤安装和配置完HACMP的软件后,发现takeover 有问题,IP接管有问题,机器自动宕机等等千奇百怪的问题,其实大都与补丁有关。所以一定要注意打补丁这个环节。如为HACMP 6110 或  IV42930以上

Apar: IV42930 

LATEST HACMP FOR AIX R610 FIXES SP11 MAY 2013  。 

  smitty install_latest,全部安装

 [host1][root][/soft_ins/ha61/patch]>ls

.toc                                               

cluster.es.cspoc.dsh.5.2.0.21.bff

cluster.adt.es.client.include.5.2.0.3.bff         ……

安装结束后,仍会报failed,检查

glvm.rpv.*

cluster.xd.glvm 

cluster.es.tc.*

cluster.es.svcpprc.*   

cluster.es.sr.rte.*        

cluster.es.spprc.*   

cluster.es.pprc.*

cluster.es.genxd.*   

cluster.es.cgpprc.*

没装上外,其他都已安装上。


补丁可在IBM网站下载:

 

补丁下载示意图

 

 重启机器

  注:记住一定要重起机器,否则安装将无法正常继续。


2.1.3. 安装确认1) 确认inittab:

egrep  -i  "hacmp" /etc/inittab

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

   在HACMP 6.1版本中,我们可以看到inittab非常简化,将所有HACMP需要开机启动相关进程的工作,全部归入一个脚本/usr/es/sbin/cluster/etc/rc.init来运行。如果你查看/etc文件/inittab文件 就会发现安装完HACMP后,仅添加了一行:

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

2) 确认安装和补丁包:(关键为cluster.es.server.rte)

lslpp -l cluster.*

  Fileset                      Level  State      Description         

  ----------------------------------------------------------------------------

Path: /usr/lib/objrepos

  …..

  cluster.es.server.rte      6.1.0.10  COMMITTED  ES Base Server Runtime

 ……

3) 确认clcomdES已启动

lssrc -s clcomdES

Subsystem         Group            PID          Status 

 clcomdES         clcomdES         4128974      active

2.2. 配置准备

    总的来说,配置前的准备必不可少,这一步还要仔细小心,准备不充分或有遗漏以及这步的细节疏忽会导致后面的配置出现网卡、磁盘找不到等现象。将会直接导致后面的配置失败。

2.2.1. 修改.rhosts

修改确认每台机器/.rhosts为:

 

[host1][root]vi  /.rhosts 

host1

host1_l2_boot1

host1_l1_boot1

host1_l2_svc   

host1_l1_svc1

host1_l1_svc2

host1_l2_boot2

host1_l1_boot2

host2

host2_l2_boot1

host2_l1_boot1

host2_l2_svc   

host2_l1_svc1   

host2_l1_svc2   

host2_l2_boot2

host2_l1_boot2

 

注意权限修改

  chmod 644 /.rhosts

    在HACMP 6.1中 为了安全起见,不再使用/.rhosts 文件来控制两台机器之间的命令和数据交换,使用 /usr/es/sbin/cluster/etc/rhosts 文件来代替 /.rhosts 文件的功能。 

注意:如果两个节点间的通讯发生了什么问题,可以检查rhosts 文件,或者编辑rhosts文件加入两个节点的网络信息。为方便配置期间检查发现问题,配置期间我们让/.rhosts和HACMP的rhosts一致。 

 

2.2.2. 修改/etc/hosts

修改确认每台机器/etc/hosts为:

127.0.0.1               loopback localhost      # loopback (lo0) name/address

 

10.2.2.1      host1_l2_boot1 

10.2.1.21      host1_l1_boot1   host1

10.2.200.1  host1_l2_svc

10.2.100.1  host1_l1_svc1

10.2.101.1  host1_l1_svc2

10.2.12.1      host1_l2_boot2 

10.2.11.1      host1_l1_boot2

10.2.2.2      host2_l2_boot1 

10.2.1.22      host2_l1_boot1 host2

10.2.200.2  host2_l2_svc   

10.2.100.2  host2_l1_svc1

10.2.101.2  host2_l1_svc2

10.2.12.2      host2_l2_boot2

10.2.11.2      host2_l1_boot2

 

注:正式配置之前,主机名落在boot地址上,待配置完成后将改为服务IP地址上。

 

确认:

[host1][root][/]>rsh host2 date

Wed Sep 11 15:46:06 GMT+08:00 2013

[host2][root][/]>rsh host1 date

Wed Sep 11 15:46:06 GMT+08:00 2013

[host1][root][/]#rsh  host1 ls -l /usr/es/sbin/cluster/etc/rhosts

-rw-------    1 root     system       237 Sep 11 15:45 /usr/es/sbin/cluster/etc/rhosts

[host1][root][/]#rsh  host2 ls -l /usr/es/sbin/cluster/etc/rhosts

-rw-------    1 root     system       237 Sep 11 15:45 /usr/es/sbin/cluster/etc/rhosts

 

 

2.2.3. 添加共享vg: 

[host1][root][/]>lspv     

hdisk0          00c1fe1f0215b425                    rootvg          active

hdisk1          00c1fe1f8d700839                    rootvg          active

hdisk2          none                   none

hdisk3          none                   none    

 

smitty vg -> Add a Volume Group

 

 [host1][root][/]>lspv

。。。

hdisk2          00f6f1569990a1ef                    host1vg      active

hdisk3          00f6f1569990a12c                    host2vg      active

 

2.2.4. 建立文件系统

    由于后面需要修改loglv,必须建立文件系统才会有loglv,所以需要先建立在host1vg 上的 /ora11runc和host2vg上的/ora11run的JFS2文件系统,其他文件系统可在实施中的配置2边同时添加。

smitty lv ->Add a Logical Volume,注意选择JFS2

smitty fs-> Enhanced Journaled File Systems -> Add a Journaled File System

[host1][root][/]>lsfs

Name            Nodename   Mount Pt               VFS   Size    Options    Auto Accounting

...

/dev/ora11runlv --         /ora11run              jfs2  15728640 rw         no   no 

/dev/ora11runclv --         /ora11runc             jfs2  10485760 rw         no   no 

...

 

2.2.5. 修改loglv 

    这一步有2个目的,一是避免两边loglv重名,二是规范loglv的取名,使它看起来更清楚明了。

host1vg (host2vg也要修改

1) 察看

[host1][root][/]>varyonvg host1vg

[host1][root][/]>lsvg -l host1vg  

host1vg:

LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT

ora11runclv         jfs2       40      40      1    closed/syncd  /ora11runc

loglv02             jfs2log    1       1       1    closed/syncd  N/A 

umount vg上所有fs

 umount /ora11runc

2) 修改loglv名称

[host1][root][/]> chlv -n host1_loglv loglv02 

0516-712 chlv: The chlv succeeded, however chfs must now be 

        run on every filesystem which references the old log name loglv02.

[host1][root][/]>lsvg -l host1vg

host1vg:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

ora11runclv        jfs2       40   40   2    closed/syncd  /ora11runc

host1_loglv      jfs2log    1     1     1    closed/syncd  N/A

[host1][root][/]> vi /etc/filesystems

"log = /dev/loglv02"的改为"log =/dev/host1_loglv"

确认:

[host1][root][/]>mount /ora11runc

 

 

2.2.6. 
整理vg

  在每台机器上都运行以下脚本(实际可以copy以下脚本到文本编辑器替换成你实际的vg

varyoffvg  host1vg

varyoffvg  host2vg

exportvg host1vg

exportvg   host2vg

chdev -l hdisk2 -a pv=yes

chdev -l hdisk3 -a pv=yes

importvg -V 101 -n -y  host1vg  hdisk2

varyonvg host1vg

chvg -an   host1vg

importvg -V 201 -n -y  host2vg  hdisk3

varyonvg host2vg

chvg -an   host2vg

varyoffvg  host1vg

varyoffvg  host2vg

确认

[host1][root][/]>lspv

。。。

hdisk2          00f6f1569990a1ef                    host1vg      

hdisk3          00f6f1569990a12c                    host2vg      

[host2][root][/]>lspv

。。。

hdisk2          00f6f1569990a1ef                    host1vg     

hdisk3          00f6f1569990a12c                    host2vg      

[host2][root][/]>varyong host1vg;varyong host2vg

[host2][root][/]>lsfs

Name            Nodename   Mount Pt               VFS   Size    Options    Auto Accounting

...

/dev/ora11runclv --         /ora11runc             jfs2  10485760 rw         no   no 

/dev/ora11runlv --         /ora10run              jfs2  15728640 rw         no   no 

 

 

2.2.7. 修改网络参数及IP地址

 

   由于AIX会cache路由配置,因此需要修改一些参数:

routerevalidate

 

[host2][root][/]no -po routerevalidate=1

Setting routerevalidate to 1

Setting routerevalidate to 1 in nextboot file

确认:

[host2][root][/]#no -a|grep routerevalidate

     routerevalidate = 1

 

  按照规划,2台机器修改IP地址 ,smitty tcpip,最终为

[host1][root][/]>netstat -in

Name  Mtu   Network     Address            Ipkts Ierrs    Opkts Oerrs  Coll

en0   1500  10.2.1  10.2.1.21     2481098     0   164719     0     0

en0   1500  link#2      2.f8.28.3a.82.3   2481098     0   164719     0     0

en1   1500  10.2.2      10.2.2.1           142470     0       10     0     0

en1   1500  link#4      2.f8.28.3a.82.5    142470     0       10     0     0

en2   1500  10.2.11     10.2.11.1              22     0       20     0     0

en2   1500  link#3      2.f8.28.3a.82.6        22     0       20     0     0

en3   1500  10.2.12     10.2.12.1               0     0        4     0     0

en3   1500  link#5      2.f8.28.3a.82.7         0     0        4     0     0

lo0   16896 127         127.0.0.1         1335968     0  1335969     0     0

lo0   16896 ::1%1                         1335968     0  1335969     0     0

lo0   16896 link#1                        1335968     0  1335969     0     0

[host1][root][/]>netstat -i

Name  Mtu   Network     Address            Ipkts Ierrs    Opkts Oerrs  Coll

en0   1500  10.2.1  host1_l1_boot1    2481124     0   164734     0     0

en0   1500  link#2      2.f8.28.3a.82.3   2481124     0   164734     0     0

en1   1500  10.2.2      host1_l2_boot1     142476     0       10     0     0

en1   1500  link#4      2.f8.28.3a.82.5    142476     0       10     0     0

en2   1500  10.2.11     host1_l1_boot2         22     0       20     0     0

en2   1500  link#3      2.f8.28.3a.82.6        22     0       20     0     0

en3   1500  10.2.12     host1_l2_boot2          0     0        4     0     0

en3   1500  link#5      2.f8.28.3a.82.7         0     0        4     0     0

lo0   16896 127         loopback          1335968     0  1335969     0     0

lo0   16896 ::1%1                         1335968     0  1335969     0     0

lo0  16896 link#1             1335968     0  1335969   0     0    

[host2][root][/]>netstat -in

[host2][root][/]#netstat -in

Name  Mtu   Network     Address            Ipkts Ierrs    Opkts Oerrs  Coll

en0   1500  link#2      2.f8.29.0.6.4     1013585     0    63684     0     0

en0   1500  10.2.1  10.2.1.22     1013585     0    63684     0     0

en1   1500  link#4      2.f8.29.0.6.5      141859     0       12     0     0

en1   1500  10.2.2      10.2.2.2           141859     0       12     0     0

en2   1500  link#3      2.f8.29.0.6.6           5     0       20     0     0

en2   1500  10.2.11     10.2.11.2               5     0       20     0     0

en3   1500  link#5      2.f8.29.0.6.7           2     0        6     0     0

en3   1500  10.2.12     10.2.12.2               2     0        6     0     0

lo0   16896 link#1                         515177     0   515177     0     0

lo0   16896 127         127.0.0.1          515177     0   515177     0     0

lo0   16896 ::1%1                          515177     0   515177     0     0

[host2][root][/]#netstat -i

Name  Mtu   Network     Address            Ipkts Ierrs    Opkts Oerrs  Coll

en0   1500  link#2      2.f8.29.0.6.4     1013619     0    63696     0     0

en0   1500  10.2.1  host2_l1_boot1    1013619     0    63696     0     0

en1   1500  link#4      2.f8.29.0.6.5      141876     0       12     0     0

en1   1500  10.2.2      host2_l2_boot1     141876     0       12     0     0

 

en2   1500  link#3      2.f8.29.0.6.6           5     0       20     0     0

en2   1500  10.2.11     host2_l1_boot2          5     0       20     0     0

en3   1500  link#5      2.f8.29.0.6.7           2     0        6     0     0

en3   1500  10.2.12     host2_l2_boot2          2     0        6     0     0

lo0   16896 link#1                         515199     0   515199     0     0

lo0   16896 127         loopback           515199     0   515199     0     0

lo0   16896 ::1%1                          515199     0   515199     0     0

2.2.8. 编写初步启停脚本 

mkdir -p /usr/sbin/cluster/app/log

[host1][root][/usr/sbin/cluster/app]>ls

start_host1  start_host2  stop_host1   stop_host2

 

#start_host1

banner start host1

route delete 0

route add 0 10.2.1.254

banner end host1

exit 0

# stop_host1

banner stop host1

banner end host1

exit 0

# start_host2

banner start host2

route delete 0

route add 0 10.2.1.254

banner end start  host2

#stop_host2

banner stop host2

banner end host2

exit 0

 记得chmod 755 start* stop*赋予文件执行权限

编写完成后记得拷贝到另一节点

 [host1][root][/usr/sbin/cluster]>rcp -rp app host2:/usr/sbin/cluster

注意:在两个节点要保证hosts 和 启动/停止脚本要一样存在,并具有执行权限,否则集群自动同步的时候会失败同时网关在启动脚本里要增加。

 

2.2.9. 配置 tty 心跳 网络/磁盘心跳

Ø 串口线心跳(两边都要增加)

.   smitty tty->Change / add a TTY->rs232->sa->port number : 0

        确认

host1: cat /etc/hosts>/dev/tty0

host2:cat</dev/tty0

 在host2可看到host1上/etc/hosts的内容。

同样反向检测一下。

 

Ø 磁盘心跳

1. 建立1个共享盘 5G足够 

2. 两边用chdev -l hdiskpower0 -a pv=yes 先将两边的盘符认出来,这样之后系统才能自动扫到磁盘

    确认

[host1][root][/]lspv

 ...     

hdisk5          00f6f1560ff93de3                    None  

 

[host2][root][/]lspv

  ...    

hdisk5          00f6f1560ff93de3                    None  

 

2.3. 
首次配置(不带应用的HACMP配置)

   以前的绝大多数配置HACMP,没有明确的这个阶段,都是先两边各自配置用户,文件系统等,然后通过修正同步来配置,这样做的好处是不受任何约束;但坏处脉络不清晰,在配置和日后使用时不能养成良好习惯,必然造成两边的经常不一致,使得停机整理VG这样各节点同步的事情重复劳动,并且很容易疏忽和遗漏。

   这一步的目的是为了配置一个和应用暂时无关的“纯粹”的HACMP,方便检测和下一步的工作,可以理解为“不带应用的HACMP配置”。

  此外,虽然HACMP配置分标准配置(Standard)和扩充配置(Extend)两种,但我个人还是偏好扩充配置,使用起来步骤更清晰明了,容易掌控。而且完全用标准配置则复杂的做不了,简单的却可能做错,不做推荐。

2.3.1. 创建集群

smitty hacmp->Extended Configuration

->Extended Topology Configuration

->Configure an HACMP Cluster

->Add/Change/Show an HACMP Cluster

 

   

                                                      

2.3.2.  增加节点  

smitty hacmp-> Extended Configuration

->Extended Topology Configuration

->Configure HACMP Nodes

->Add a Node to the HACMP Cluster

 

   注:此处的Node Name需要手动输入,为机器主机名。Communication Path to Node可以通过F4选择为:主机名的boot地址。

同理可以添加第二个节点

 

2.3.3. 创建IP网络及接口

 

smitty hacmp-> Extended Configuration

-> Extended Topology Configuration

->Configure HACMP Networks

->Add a Network to the HACMP Cluster->ether

 

其中Enable IP Address Takeover via IP Aliases  [Yes]  

   此选项决定了HACMP的IP切换方式,但值得一提的是只有“boot1/boot”、“boot2/standby”、“svc/service”三个IP分别为三个不同网段时必须选用IP Aliases方式。

       如果““boot1/boot”、“boot2/standby”其中一个与“svc/service”为同一个网段时必须选用IP Replace方式,则此选项应选“NO”。

同样完成net_ether_02网络的创建。

 

向这些网络添加boot地址网络接口:

smitty hacmp-> Extended Configuration

-> Extended Topology Configuration

->Configure HACMP Communication Interfaces/Devices

->Add Communication Interfaces/Devices

->Add Pre-defined Communication Interfaces and Devices

-> Communication Interfaces 

选择之前建立 的net_ether_01增加2个boot地址:

 

 

 

同样,将其他boot地址加入。

 

2.3.4. 添加心跳网络及接口(二选一)

->diskdb

 

1. 串口心跳

 

smitty hacmp-> Extended Configuration

-> Extended Topology Configuration

->Configure HACMP Networks

->Add a Network to the HACMP Cluster

->rs232

 

添加心跳设备接口:

smitty hacmp-> Extended Configuration

-> Extended Topology Configuration

->Configure HACMP Communication Interfaces/Devices

->Add Communication Interfaces/Devices

->Add Pre-defined Communication Interfaces and Devices

-> Communication Devices 

>选择之前建立的net_rs232_01

 

 

   # Node                Device           Device Path    

host1              tty0               /dev/tty0

host2              tty0               /dev/tty0

 

   

2. 磁盘心跳

  smitty hacmp->System Management (C-SPOC)

->Storage->Volume Groups

->Manage Concurrent Access Volume Groups for Multi-Node Disk Heartbeat

->Create a new Volume Group and Logical Volume for Multi-Node Disk Heartbeat

 

 

选择之前的预先认出的hdisk5这块心跳磁盘。

 

 

 

 比之前更简单,一个菜单即同时完成了磁盘心跳VG、LV、网络、设备在2个节点的添加。

 

 

 

  

       至此HACMP的拓扑结构已配置完成。

 

2.3.5. 察看确认拓扑(toplog)结构   

 smit hacmp->Extended Configuration

->Extended Topology Configuration

->Show HACMP Topology

  ->Show Cluster Topology

Cluster Name: test_cluster

Cluster Connection Authentication Mode: Standard

Cluster Message Authentication Mode: None

Cluster Message Encryption: None

Use Persistent Labels for Communication: No

 

NODE host1:

        Network net_diskhb_01

        Network net_diskhbmulti_01

                host1_1 /dev/mndhb_lv_01

        Network net_ether_01

                host1_l1_boot1  10.2.1.21

                host1_l1_boot2  10.2.11.1

        Network net_ether_02

                host1_l2_boot1  10.2.2.1

                host1_l2_boot2  10.2.12.1

        Network net_rs232_01

 

NODE host2:

        Network net_diskhb_01

        Network net_diskhbmulti_01

                host2_2 /dev/mndhb_lv_01

        Network net_ether_01

                host2_l1_boot2  10.2.11.2

                host2_l1_boot1  10.2.1.22

        Network net_ether_02

                host2_l2_boot1  10.2.2.2

                host2_l2_boot2  10.2.12.2

        Network net_rs232_01

                                       

如心跳为串口心跳则为:

Cluster Name: test_cluster

Cluster Connection Authentication Mode: Standard

Cluster Message Authentication Mode: None

Cluster Message Encryption: None

Use Persistent Labels for Communication: No

 

NODE host1:

        Network net_ether_01

                host1_l1_boot1  10.2.1.21

                host1_l1_boot2  10.2.11.1

        Network net_ether_02

                host1_l2_boot1  10.2.2.1

                host1_l2_boot2  10.2.12.1

        Network net_rs232_01

                host1_tty0_01  /dev/tty0

 

NODE host2:

         Network net_ether_01

               host2_l1_boot2  10.2.11.2

                host2_l1_boot1  10.2.1.22

        Network net_ether_02

                host2_l2_boot1  10.2.2.2

                host2_l2_boot2  10.2.12.2

        Network net_rs232_01

                host2_tty0_01  /dev/tty0

      

   可以看到已符合规划要求,可继续了

         

2.4. 创建资源2.4.1. 添加高可用资源

(service ip , application server , vg and fs )

1) 添加app server 

smitty hacmp ->Extended Configuration

->Extended Resource Configuration

->HACMP Extended Resources Configuration

->Configure HACMP  Applications

         ->Configure HACMP  Application Servers

->Add an Application Server

* Server Name                                        [host1_app]

*Start Script                                       [/usr/sbin/cluster/app/start_host1]
* Stop Script                                        [/usr/sbin/cluster/app/stop_host1]

  Application Monitor Name(s)                                                             

同样增加 host2_app

* Server Name                                        [host2_app]

*Start Script                                       [/usr/sbin/cluster/app/start_host2]
* Stop Script                                        [/usr/sbin/cluster/app/stop_host2]

 

2) 添加service ip 

smity 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

选择net_ether_01(10.2.1.0/24 10.2.11.0/24)

 

* IP Label/Address                                    host1_l1_svc                                                                 

* Network Name                                        net_ether_01

Alternate HW Address to accompany IP Label/Address []

同样增加其他服务ip地址。 

 

 

3) 创建资源组

 smitty hacmp->Extended Configuration

-> Extended Resource Configuration

 ->HACMP Extended Resource Group Configuration

-> Add a Resource Group

                      Add a Resource Group (extended)

Type or select values in entry fields.

Press Enter AFTER making all desired changes.     [Entry Fields]

* Resource Group Name                [host1_RG]

* Participating Nodes (Default Node Priority) [host1  host2]                                                

  Startup Policy                   Online On Home Node Only                                      

  Fallover Policy                  Fallover To Next Priority Node In The List                    

  Fallback Policy                    Fallback To Higher Priority Node In The List

同样建立host2_RG, 

….

Resource Group Name                          [host2_RG]

* Participating Nodes (Default Node Priority)        [host2 host1]  

注意,这里如果是主备模式,如host2仅做备机,则为:

Resource Group Name                          [host2_RG]

* Participating Nodes (Default Node Priority)        [host2]  

 

4) 配置资源组

smitty hacmp->Extended Configuration

->Extended Resource Configuration

 ->HACMP Extended Resource Group Configuration

->Change/Show Resources and Attributes for a Resource Group

           选择host1_RG

             Change/Show All Resources and Attributes for a Resource Group

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                       [Entry Fields]

  Resource Group Name                     host1_RG

  Participating Nodes (Default Node Priority)   host1 host2

  

  Startup Policy                         Online On Home Node Only

  Fallover Policy                         Fallover To Next Priority Node In The List

  Fallback Policy                         Fallback To Higher Priority Node In The List

  Fallback Timer Policy (empty is immediate)   []                                                             

  

  Service IP Labels/Addresses     [host1_l1_svc1 host1_l1_svc2 host1_l2_svc ]       

  Application Servers                         [host1_app]                                                     

  Volume Groups                             [host1vg]                                                   

  Use forced varyon of volume groups, if necessary    false         

同样的方法配置host2_RG

 

 

 

2.4.2. 检查和同步HACMP配置

(注意:以上配置均在host1上完成,同步至少2次,先强制同步到host2)

smitty hacmp ->Extended Configuration

->Extended Verification and Synchronization

1)首次强制同步:

               HACMP Verification and Synchronization

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                                [Entry Fields]

* Verify, Synchronize or Both                        [Both]                                                         

* Automatically correct errors found during          [Yes]                                                           

  verification?

* Force synchronization if verification fails?       [Yes]                                                           

* Verify changes only?                               [No]                                                           

* Logging                                            [Standard]  

  2)二次同步:

               HACMP Verification and Synchronization

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                                [Entry Fields]

* Verify, Synchronize or Both                        [Both]                                                         

* Automatically correct errors found during          [Yes]                                                           

  verification?

* Force synchronization if verification fails?       [No]                                                           

* Verify changes only?                               [No]                                                           

* Logging                                            [Standard]  

 

注:此处结果为OK才能继续,否则按后续故障章节根据错误信息查找原因处理.

 

2.5. 最后的其他配置2.5.1. 再次修改/etc/hosts

将其改为svc的地址上,因为HACMP启动后即以此地址对外服务,主机名需要对应。

 

10.2.2.1      host1_l2_boot1 

10.2.1.21      host1_l1_boot1

10.2.200.1  host1_l2_svc host1

10.2.100.1  host1_l1_svc1

10.2.101.1  host1_l1_svc2

10.2.12.1      host1_l2_boot2 

10.2.11.1      host1_l1_boot2

10.2.2.2      host2_l2_boot1

10.2.1.22      host2_l1_boot1

10.2.200.2  host2_l2_svc   host2

10.2.100.2  host2_l1_svc1

10.2.101.2  host2_l1_svc2

10.2.12.2      host2_l2_boot2

10.2.11.2      host2_l1_boot2

 

2.5.2. 修改syncd daemon的数据刷新频率  

   该值表示刷新内存数据到硬盘的频率,缺省为60,HACMP安装后一般可改为10,立刻即可生效。

smitty hacmp ->  HACMP Extended Configuration

-> Extended Performance Tuning Parameters Configuration 

-> Change/Show syncd frequency 

修改为10秒

 

 

 or 

 

运行命令/usr/es/sbin/cluster/utilities/clchsyncd 10亦可

确认:

[host1][root]#ps -ef|grep sync

root 11927616        1   0 16:11:23  pts/0  2:31 /usr/sbin/syncd 10

 

2.5.3. 配置clinfo  

   注:对于双节点,clstat等监控集群信息软件的基础为clinfoES服务,必须运行在每个Node节点上。

 

 1)修改确认每台机器的/es/sbin/cluster/etc/clhosts为:

127.0.0.1               loopback localhost      # loopback (lo0) name/address

 

10.2.2.1      host1_l2_boot1 

10.2.1.21      host1_l1_boot1   host1

10.2.200.1  host1_l2_svc

10.2.100.1  host1_l1_svc1

10.2.101.1  host1_l1_svc2

10.2.12.1      host1_l2_boot2 

10.2.11.1      host1_l1_boot2

10.2.2.2      host2_l2_boot1 

10.2.1.22      host2_l1_boot1 host2

10.2.200.2  host2_l2_svc   

10.2.100.2  host2_l1_svc1

10.2.101.2  host2_l1_svc2

10.2.12.2      host2_l2_boot2

10.2.11.2      host2_l1_boot2

 

 

执行拷贝:

rcp /usr/es/sbin/cluster/etc/clhosts  host2:/usr/es/sbin/cluster/etc/clhosts

 

2)将snmp v3转换为snmp v1

/usr/sbin/snmpv3_ssw -1 

 

3) 修改启动clinfoES

     chssys -s clinfoES -a "-a"

 startsc -s clinfoES

 

确认

[host1][root][/]#rsh  host1 ls -l /usr/es/sbin/cluster/etc/clhosts

-rw-r--r--    1 root     system         4148 Sep 16 10:27 /usr/es/sbin/cluster/etc/clhosts

 

[host1][root][/]#rsh  host2 ls -l /usr/es/sbin/cluster/etc/clhosts

-rw-r--r--    1 root     system         4148 Sep 16 10:27 /usr/es/sbin/cluster/etc/clhosts

 

/usr/es/sbin/cluster/clstat运行不报错。

 

  注意:此步骤不能疏漏,必须确保clinfo实施完成后正常运行,否则后续集群状态检查cldump、clstat将均报错,集群状态将无法检查监控

 

 

恭喜!到此为止我们的HACMP已经基本配置完成了

 

 

2.5.4.   启动HACMP

  在所有节点分别启动HACMP服务:

  smitty clstart

                                                

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

* Start now, on system restart or both                now                    +

  Start Cluster Services on these nodes              [host1]                 +

* Manage Resource Groups                              Automatically          +

  BROADCAST message at startup?                       false                  +

  Startup Cluster Information Daemon?                 true                   +

  Ignore verification errors?                         false                  +

  Automatically correct errors found during           Interactively          +

  cluster start?

 

                             Start Cluster Services

 

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

 

                                                        [Entry Fields]

* Start now, on system restart or both                now                    +

  Start Cluster Services on these nodes              [host2]                 +

* Manage Resource Groups                              Automatically          +

  BROADCAST message at startup?                       false                  +

  Startup Cluster Information Daemon?                 true                   +

  Ignore verification errors?                         false                  +

  Automatically correct errors found during           Interactively          +

  cluster start?

 

 

2.5.5.   确认HACMP配置完成

     使用HACMP的工具clverify,cldump,clstat检查,参见运维篇的日常检查一节。另外从安全角度,记得清理掉 /.rhosts文件。

2.6. 集成实施中的配置

   HACMP首次配置后,这个步骤会和实际应用程序的安装配置工作交织在一起,时间跨度较长,并可能有反复,所以单独列出一章。并利用首次配置没有完成的设计部分,加以举例讲解,实际如设计清楚,可以首次配置即完成。

   此过程如果不注意实施细节,会导致两边配置不一致,HACMP在最终配置时需要重新整理VG或同步增加用户等工作。

   

   本章的其他操作和运维篇的变更与实现近乎雷同,只对添加部分介绍。

 

   利用C-SPOC,我们可以实现在任一台节点机上操作共享或并发的LVM组件(VG,lv,fs),系统的clcomd的Demon自动同步到其他机器上。

  root 237690 135372   0   Dec 19      -  0:26 /usr/es/sbin/cluster/clcomd -d

2.6.1. 增加组和用户

   利用HACMP的功能,只需在一台机器如host1上操作,会自动同步到另一台如host2

 

增加组:

smitty hacmp->System Management (C-SPOC)

    -> Security and Users 

-> Groups in an HACMP cluster

-> Add a Group to the Cluster 

选择host2_RG

                    Add a Group to the Cluster

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

                                                        [Entry Fields]

  Select nodes by Resource Group                      host2_RG

   *** No selection means all nodes! ***

  * Group NAME                                         [dba]

  ADMINISTRATIVE group?                               false                                                                      

  Group ID                                           [601]  

….                                                                         

同样在host1_RG增加tux组.

增加用户

smitty hacmp->System Management (C-SPOC)

    -> Security and Users 

     ->Users in an HACMP cluster

       -> Add a User to the Cluster

选择host2_RG

                        Add a User to the Cluster

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[TOP]                                                   [Entry Fields]

  Select nodes by Resource Group                      host2_RG

   *** No selection means all nodes! ***

* User NAME                                         [orarun]

  User ID                                            [609

 Primary GROUP                                      [dba

....       

其他根据具体情况可设置                       

同样在host1_RG增加orarunc,xcom等用户

确认

 

[host2][root][/]>lsgroup ALL

[host2][root][/]> lsuser  -a id groups ALL

注意:是在host1上执行建组和用户的动作,在host2上确认结果

 

初始化用户口令

smitty hacmp->System Management (C-SPOC)

    -> Security and Users

        -> Passwords in an HACMP cluster

            -> Change a User's Password in the Cluster

  Selection nodes by resource group                   host2_RG

   *** No selection means all nodes! ***

* User NAME                                     [orarun]                                                                    

  User must change password on first login?           false   

  此时需要你输入新口令更改:                         

             COMMAND STATUS

Command: running       stdout: no            stderr: no

Before command completion, additional instructions may appear below.

orarun's New password: ******

Enter the new password again:******

OK即成功,当然其他用户也需要。

 

2.6.2. 增加lv和文件系统

   同样利用HACMP的C-SPOC功能,只需在一台机器操作,会自动同步到另一台,无需考虑VG是否varyon。

增加lv:

 

smitty HACMP-> System Management (C-SPOC)

  ->   Storage 

    ->  Logical Volumes

      ->Add a Logical Volume 

              选择host2vg     host2_RG 

                   host2 hdisk3

                             Add a Logical Volume

Type or select values in entry fields.       

Press Enter AFTER making all desired changes.

[TOP]                                                   [Entry Fields]

  Resource Group Name                                 host2_RG 

  VOLUME GROUP name                                   host2vg

  Node List                                           host1,host2

  Reference node                                      host2

* Number of LOGICAL PARTITIONS                       [80]                     #

  PHYSICAL VOLUME names                               hdisk3

  Logical volume NAME                                [oradatalv]

  Logical volume TYPE                                [jfs2]                  +

  POSITION on physical volume                         outer_middle           +

  RANGE of physical volumes                           minimum                +

                 

同样建立host1_RG的其他lv。

 

建立文件系统:

smitty hacmp-> System Management (C-SPOC)

 ->   Storage 

    -> File Systems

      ->  Add a File System

  选择  host2vg         host2_RG 

        Enhanced Journaled File System    

        oradatalv host1,host2

 

                                                                 

…. 

 同样建立其他文件系统,建立好后,这些文件系统自动mount。

 

确认:

[host2][root][/]#df -g

....

/dev/oradatalv     10.00     10.00    1%        4     1% /oradata

 

 

修改文件系统的目录权限,保证两边一致,。

[host2][root][/]>chown orarun:dba /ora11run

[host2][root][/]>umount /ora11run

[host2][root][/]>chown orarun:dba /ora11run

 

[host1][root][/]>chown orarun:dba /ora11run

同样其他文件系统也要如此操作

注意:修改3遍的原因为有些应用对mount前文件系统的目录也有权限要求,此外两边权限不一致也会导致切换时脚本不能正常访问文件系统,详见日常运维篇。

 

确认:

[host2][root][/]>df -g

[host2][root][/]>ls -l /oradata

[host1][root][/]>df -g

 

2.6.3. 安装和配置应用

   这里包括安装配置host2上的数据库和host1上的tuxedo、mes、通信软件,由于和HACMP本身关系不大,所以不再描述。

 2.7. 最终配置(带应用的HACMP配置)

    这一步一般在应用程序已经稳定,不做大的变动时进行。大都是在系统快上线前的一段时间进行,伴随最终设置的完成,应该跟随一个完整测试

  这一步也可以理解为“带应用的HACMP配置”,所以主要工作是确认在HACMP的切换等行为中,应用脚本的正确性和健壮性。

2.7.1. 起停脚本已经编写完备并本机测试

    自行编写脚本,也可参见脚本篇编写,并通过启停测试

2.7.2.  同步脚本和用户的.profile等环境文件

 

  可先在其中一台如host1测完所有脚本,然后统一同步到另一台。

[host1][root][/]>rcp -rp /usr/sbin/cluster/app host2:/usr/sbin/cluster/

 

[host1][root][/home]>tar -cvf host2_user.tar ora11run 

[host1][root][/home]>rcp host2_user.tar host2:/home

[host1][root][/home]>tar -xvf host2_user.tar

[host1][root][/home] >tar -cvf host1_user.tar ora11runc tuxrun bsx1 xcom 

[host1][root][/home]>rcp host1_user.tar host2:/home

[host2][root][/home]>tar -xvf  host1_user.tar

 

 

如采用了本文的脚本篇的编制方式,也不要忘了同步

 [host2][root][/home/scripts]>rcp -rp comm host1:/home

 [host1][root][/home/scripts]>rcp -rp host2  host1:/home/scripts

 [host1][root][/home/scripts]>rcp -rp host1:/home/scripts/host1 .

 

 

2.7.3. 确认检查和处理

  这一步是确认经过一段时间后,HACMP是否需要修正和同步,参考运维篇的日常检查及处理

 

2.7.4. 测试:

  建议实施完整测试,最低限度为标准测试,参见测试篇

 

 

      至此,我们完成了整个HACMP的上线前的集成实施工作,具备了系统上线的条件。


如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

1

添加新评论5 条评论

kt563kt563数据库管理员, 交行卡中心
2014-04-11 11:28
mark下,图片能看到就好了。。。
mxin辛旻mxin辛旻资深工程师, 上海宝信软件股份有限公司
2014-03-11 12:23
图片博客不支持直接粘贴,如需要可到论坛下载pdf格式。
wu100zhewu100zhe软件开发工程师, 重庆数码
2014-03-06 12:43
就是啊,图片.
semitersemiter系统工程师, 某公司
2014-02-25 08:25
图片一个都看不到
daoguo525daoguo525系统工程师, 世纪五岳(北京)科技有限公司
2014-02-24 19:27
Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广