---
title: "HP双机（转自chinaunix）"
author: "andyniu"
date: "2014-01-27T11:37:31Z"
tags: []
categories: ["操作系统"]
slug: "hp-chinaunix"
draft: false
lastmod: "2014-01-27T11:37:31Z"
id: 2009828
url: "https://andyniu.iteye.com/blog/2009828"
---

1.安装好A机和B机的操作系统后，安装相应的软件MC/SG等   
 软件安装完后在安装GOLDENPATCH和最新的megaPATCH 

2.在配置双机前必须使A机和B机能够相互信任   
使用VI 编辑文件根目录下的.rhosts，如没有，自己就建立一个   
＃vi .rhosts   
A  root  #A为A机的主机名   
B  root  ＃B为B机的主机名 

3.在A机和B机上重复上面的步骤或将此文件直接拷贝至B机的根目录，   
然后使用"rlogin 主机名"在两台主机间切换，验证信任关系是否成立。   
如不需要密码认证则表示成功。 

4.编辑/etc/hosts文件，将所有的（这里为两台主机）IP地址   
（包括心跳地址、网卡地址等）加到此文件中，以备解析时使用。 

5.创建需要共享的VG，这里VG的创建就不详细说明了。 

6.为双机创建锁卷组和锁磁盘   
目前比较流行的方式是利用共享的卷组作为锁卷组   
利用共享卷组中的磁盘作为锁磁盘   
举例说明如下：   
我建立了一个共享的VG名字叫VGSYB，上安装SYBASE   
在下面将要讲的如何配置群集ASCII文件的时候，里面将会碰到下面的配置   
FIRST\_CLUSTER\_LOCK\_VG /dev/vgsyb   
FIRST\_CLUSTER\_LOCK\_PV /dev/dsk/c4t1d2 

这里的VGSYB就是我建立的共享卷组，同时我将其也作为了锁卷组。   
这个共享卷组中的c4t1d2磁盘被我用来当作锁磁盘，这样的好处是，不用单独建立VGLOCK和锁磁盘 

7\. #vgchange -a e /dev/vgsyb   使此VG只能由一台主机接管 

8\. #vgchange -a y /dev/vgsyb   激活此锁卷组 

9. 在其中的一台机器上执行此命令，在此我选择在A机上生成双机的配置模板 

  #cmquerycl -v  -n A机名  -n B机名  -C /etc/cmcluster/cmclconfig.ascii   
    
如没有错误的话，将生成上面的模板文件，并用vi编辑它 

10\. #cmcheckconf -v -C /etc/cmcluster/cmclconfig.ascii 让系统检查模板 

11.执行下面的命令前必须使锁卷组为激活状态   
#cmapplyconf -v -C  /etc/cmcluster/cmclconfig.ascii 分发二进制文件到所有的节点 

12.#vgchange -a n  /dev/vgsyb  停用此锁卷组，等待由[]()**双机软件**来激活锁卷组 

13.#cmruncl  启动双机   
   cmhaltcl -f  []()**停双机**   
   cmviewcl -v  查看双机的状态   
   cmrunnode    启动一个节点   
   cmhaltnode   停一个节点 

14.注明：/etc/fstab中不能出现被双机共享的卷组 

15.注明：以下为一个cmclconfig.ascii的文件内容，大家可以看一看里面的英文注释，及以下相关的配置参数 

\# \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**   
\# \*\*\*\*\*\*\*\** HIGH AVAILABILITY CLUSTER CONFIGURATION FILE \*\*\*\*\*\*\*\*\*\*\*\*\*\**   
\# \*\*\*\** For complete details about cluster parameters and how to    \*\*\**   
\# \*\*\*\** set them, consult the cmquerycl(1m) manpage or your manual. \*\*\**   
\# \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\** 

\# Enter a name for this cluster.  This name will be used to identify the   
\# cluster when viewing or manipulating it. 

CLUSTER\_NAME cl\_db 

\# Cluster Lock Device Parameters.  This is the volume group that   
\# holds the cluster lock which is used to break a cluster formation   
\# tie.  This volume group should not be used by any other cluster   
\# as cluster lock device. 

\# Warning: No volume groups were found on all nodes.   
\# A cluster lock volume group is required for clusters of only two nodes.   
FIRST\_CLUSTER\_LOCK\_VG /dev/vgsyb 

\# Definition of nodes in the cluster.   
\# Repeat node definitions as necessary for additional nodes. 

NODE\_NAME JSta   
 NETWORK\_INTERFACE lan2   
   HEARTBEAT\_IP 192.9.200.2   
 NETWORK\_INTERFACE lan3   
 NETWORK\_INTERFACE lan1   
   STATIONARY\_IP 132.228.39.2 

\# Warning: No volume groups were found on all nodes.   
\# A cluster lock device is required for clusters of only two nodes.   
 FIRST\_CLUSTER\_LOCK\_PV /dev/dsk/c4t1d2   
\# List of serial device file names   
\# For example:   
\# SERIAL\_DEVICE\_FILE /dev/tty0p0 

\# Possible standby Network Interfaces for lan1: lan3.   
\# Warning: There are no standby network interfaces for lan2. 

NODE\_NAME JStb   
 NETWORK\_INTERFACE lan2   
   HEARTBEAT\_IP 192.9.200.3   
 NETWORK\_INTERFACE lan3   
 NETWORK\_INTERFACE lan1   
   STATIONARY\_IP 132.228.39.3 

\# Warning: No volume groups were found on all nodes.   
\# A cluster lock device is required for clusters of only two nodes.   
 FIRST\_CLUSTER\_LOCK\_PV /dev/dsk/c4t1d2   
\# List of serial device file names   
\# For example:   
\# SERIAL\_DEVICE\_FILE /dev/tty0p0 

\# Possible standby Network Interfaces for lan1: lan3.   
\# Warning: There are no standby network interfaces for lan2. 

\# Cluster Timing Parmeters (microseconds). 

HEARTBEAT\_INTERVAL 1000000   
NODE\_TIMEOUT 2000000 

\# Configuration/Reconfiguration Timing Parameters (microseconds). 

AUTO\_START\_TIMEOUT 600000000   
NETWORK\_POLLING\_INTERVAL 2000000 

\# Package Configuration Parameters.   
\# Enter the maximum number of packages which will be configured in the cluster.   
\# You can not add packages beyond this limit.   
\# This parameter is required.   
MAX\_CONFIGURED\_PACKAGES 4 

\# List of cluster aware Volume Groups. These volume groups will   
\# be used by package applications via the vgchange -a e command.   
\# For example:   
\# VOLUME\_GROUP /dev/vgdatabase.   
\# VOLUME\_GROUP /dev/vg02. 

VOLUME\_GROUP /dev/vgsyb