注明:本安装步骤不是 Dell 的标准文档,不能直接发给客户,仅供学习参考。

环境说明:
1
硬件:

说明:按照标准至少需要 4 块网卡和其他相应硬件,但因为条件限制,故在硬件和设置上做了一些变通。

服务器: PE4300 PE4600
网卡:两个
RAID
:两块 PERC2/SC
StorageV220S
SCSI cable

2
软件:
OS
RedHat Advance Server 2.1
Kernel: 2.4.9-e.3smp

配制分配:
IP: node1: 10.0.0.1/8
node2: 10.0.0.2/8
Cluster IP: 10.0.0.3
这个地址不同于 Microsoft 下的 Cluster server IP address ,该地址是用于管理上用的。


基本步骤:

一、安装 OS

说明:为了安装可以顺利进行,建议先移掉 RAID 卡,否则在拷贝完文件后系统不能正常启动。因为,当使用插卡( RAID/SCSI )连接外置磁盘柜,它们将总是优先于本地硬盘被检测,这个将导致本地的盘符被改变。

按照通常的步骤安装 OS ,在系统安装完后,将 RAID SCSI 卡插回主机,在下次重启时系统将自动发现新设备。但为了保证在每次系统引导时该设备能自动启动,你仍需做以下两步:

a.
编辑 /etc/modules.conf 文件,同时增加下面内容到文件内容中

alias scsi_hostadapter megaraid
options scsi_mod max_scsi_luns=255 à
可提前增加这一行,因为有共享磁盘柜存
在,并且有多个 LUN 在上面时,系统要求这样做。



b.
执行

Mkinitrd initrd-2.4.9-e.3smp.img 2.4.9-e.3smp à
这行的内容主要还是由内核来决定。

例:
/etc/modules.conf:

alias scsi_hostadapter megaraid

options scsi_mod max_scsi_luns=255


二、物理连接

这部份的步骤与 W2K 一样,即先用一个节点配制 LUN ,另一个节点从磁盘读 LUN 配制,同时保证 2 RAID 卡的 Cluster 功能开启, SCSI ID 不能冲突,同时将 PV220S 的开关拨动到 Cluster 模式。

三、安装和配制分区

1
.建立分驱
说明:建议在此时只开一个节点。在系统启动后,系统可以识别在磁盘柜上新建的 LUN 。设备名通常是在本地硬盘后顺序编排。例如:当本地是 /dev/sda ,那么新的设备是 /dev/sdb

分区的原则和要求: Quorum 分区的要求:不能小于 10M ,必须是裸设备,不能有文件系统。
Quorum
分区只能用于 Cluster 的状态和配制信息。
Quorum
要求两个分区,一个为 primary, 另一个为 slave
Cluster
应用服务的分区:要求一个 cluster 服务一个分区。例如:你想有 SQL NFS SAMBA 三个 Cluster 应用服务,那么你必须为三个服务各建一个分区。

例: fdisk /dev/sdb 创建新的分区

/dev/sdb1 àQuorum primary partition
/dev/sdb2 àQuorum slave partition
/dev/sdb3 àSql partition
/dev/sdb4 àNFS partition
/dev/sdb5 àsamba partition

注意:在创建完分驱后,一定要重启主机,建议重启所有设备。

2
.建立文件系统 ―― 即格式化分区

说明: Quorum 必须是裸设备 , 所以不需要格式化。但其他分区必须格式化,同时将默认的 Block 块大小增大到 4096 ,默认为 1024


例:
mkfs –t ext2 –j –b 4096 /dev/sdbx –-
X 代表分区

3
.为 Cluster 创建 Quorum 分区
说明:使用命令 cat /proc/devices 确认系统是否支持裸设备,如果你看到下面的输出,说明系统可以支持裸设备。

162 raw

在两台服务器上分别编辑 /etc/sysconfig/rawdevices 文件,以便将分区绑定到裸设备。

: /etc/sysconfig/rawdevices
# format:
#
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2

重启服务 service rawdevices restart


4
.检查和验证 Quoram 分区

在两个节点上分别 cludiskutil –p 确保两个节点都能有以下输出:

----- Shared State Header ------
Magic# = 0x39119fcd
Version = 1
Updated on Thu Sep 14 05:43:18 2000
Updated by node 0




四、建立 Cluster 服务

说明:确保所有网卡正常工作。同时,设置基本的网络要求。

1
.编辑 /etc/hosts 文件

127.0.0.1 localhost.localdomain localhost
10.0.0.1 node1.test.com node1
10.0.0.2 node2.test.com node2
10.0.0.3 Clusteralias.test.com Clusteralias

2
.运行 /sbin/cluconfig

说明:系统将自动生成 cluster 的配制文件 /etc/cluster.conf ,这一步只需要在其中一个节点上运行。

你将看到以下输出:

Enter cluster name  Cluster :Cluster
Enter IP address for cluster alias [x.x.x.x]: 10.0.0.3
--------------------------------
Information for Cluster Member 0
--------------------------------
Enter name of cluster member [storage0]: node1
Looking for host storage0 (may take a few seconds)...
Enter number of heartbeat channels (minimum = 1) [1]: 1
Information about Channel 0
Channel type: net or serial [net]:
Enter hostname of the cluster member on heartbeat channel 0 \
[node1]: node1
Looking for host node1 (may take a few seconds)...
Information about Quorum Partitions
Enter Primary Quorum Partition [/dev/raw/raw1]: /dev/raw/raw1
Enter Shadow Quorum Partition [/dev/raw/raw2]: /dev/raw/raw2
Information About the Power Switch That Power Cycles Member ’storage0’
Choose one of the following power switches:
o NONE
o RPS10
o BAYTECH
o APCSERIAL
o APCMASTER
o WTI_NPS
Power switch  NONE : NONE

Information for Cluster Member 1
--------------------------------
Enter name of cluster member [node2]: node2
Looking for host storage1 (may take a few seconds)...
Information about Channel 0
Enter hostname of the cluster member on heartbeat channel 0 \
[node2]: node2
Looking for host storage1 (may take a few seconds)...
Information about Quorum Partitions
Enter Primary Quorum Partition [/dev/raw/raw1]: /dev/raw/raw1
Enter Shadow Quorum Partition [/dev/raw/raw2]: /dev/raw/raw2
Information About the Power Switch That Power Cycles Member ’node2’
Choose one of the following power switches:
o NONE
o RPS10
o BAYTECH
o APCSERIAL
o APCMASTER
o WTI_NPS
Power switch  NONE : NONE

Cluster name: Development Cluster
Cluster alias IP address: 10.0.0.154
Cluster alias netmask: 255.255.254.0
--------------------
Member 0 Information
--------------------
Name: node1
Primary quorum partition: /dev/raw/raw1
Shadow quorum partition: /dev/raw/raw2
Heartbeat channels: 1
Channel type: net, Name: node1
Power switch IP address or hostname: node1
--------------------
Member 1 Information
--------------------
Name: node2
Primary quorum partition: /dev/raw/raw1
Shadow quorum partition: /dev/raw/raw2
Heartbeat channels: 1
Channel type: net, Name: node2
Save the cluster member information? yes/no [yes]:
Writing to configuration file...done
Configuration information has been saved to /etc/cluster.conf.
----------------------------
Setting up Quorum Partitions
----------------------------
Running cludiskutil -I to initialize the quorum partitions: done
Saving configuration information to quorum partitions: done
Do you wish to allow remote monitoring of the cluster? yes/no \
[yes]: yes
----------------------------------------------------------------
Configuration on this member is complete.
To configure the next member, invoke the following command on that system:
# /sbin/cluconfig --init=/dev/raw/raw1
See the manual to complete the cluster installation

3
.配制第二个节点

只需执行 cluconfig --init=/dev/raw/raw1


4
.启动 Cluster 服务

分别在两个节点上执行 service cluster start
你将看到下面的几个 Daemon
• cluquorumd — Quorum daemon
• clusvcmgrd — Service manager daemon
• clupowerd — Power daemon
• cluhbd — Heartbeat daemon
• clumibd — Administrative system monitoring daemon

五、建立 Cluster 应用服务

说明:本次实验只测试了 Samba ,其他应用服务的建立,请参考 RedHat 文档。
.
1
Samba
明: Samba cluster 的环境下与单机有一些不同,首先是配制文件的改变,不在是 /etc/samba/smb.conf ,而是 /etc /samba/smb.conf.xxxàxxx 代表你的共享名字,可以是任何字母。 Samba cluster 环境下需要自己的 locking 目录 /var/cache/samba/xxxx


2.
运行 /sbin/cluadmin

说明:只需要在其中一个节点执行该命令,当你执行上面的命令你将看到以下输出:

Service name: samba
  à 所有黑色字体代表手工输入接受其默认值
Preferred member  None :Node1 à
这行代表 Samba 服务将默认在 node1 上运行。
Relocate when the preferred member joins the cluster (yes/no/?) [no]: yes
User script (e.g., /usr/foo/script or None)  None :
Status check interval [0]: 10
Do you want to add an IP address to the service (yes/no/?) [no]: yes
IP Address Information
IP address: 10.0.0.10 à
这行代表 Samba 服务运行的 IP 地址,即 windows 客户端访问输入的 IP 地址。
Netmask (e.g. 255.255.255.0 or None)  None :
Broadcast (e.g. X.Y.Z.255 or None)  None :
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address, or
are you (f)inished adding IP addresses [f]:f
Do you want to add a disk device to the service (yes/no/?) [no]: yes
Disk Device Information
Device special file (e.g., /dev/sdb4): /dev/sdb3
Filesystem type (e.g., ext2, ext3 or None): ext3
Mount point (e.g., /usr/mnt/service1)  None : /data à
这行代表真正共享的存放地。
Mount options (e.g., rw,nosuid,sync): rw,nosuid,sync
Forced unmount support (yes/no/?) [yes]:
Would you like to allow NFS access to this filesystem (yes/no/?)\
[no]: no
Would you like to share to Windows clients (yes/no/?) [no]: yes
You will now be prompted for the Samba configuration:
Samba share name: samba –>;
这行即 windows 客户端在网上邻居看到的名字。
The samba config file /etc/samba/smb.conf.samba does not exist.
Would you like a default config file created (yes/no/?) [no]: yes
Successfully created daemon lock directory /var/cache/samba/acct.

Please run ‘mkdir /var/cache/samba/samba‘ on the other cluster member.
Successfully created /etc/samba/smb.conf.samba.
Please remember to make necessary customizations and then copy the file
over to the other cluster member.
Do you want to (a)dd, (m)odify, (d)elete or (s)how DEVICES, or
are you (f)inished adding DEVICES [f]: f
name: samba
preferred node:node1
relocate: yes
user script: None
monitor interval: 30
IP address 0: 10.0.0.10
netmask 0: None
broadcast 0: None
device 0: /dev/sdb12
mount point, device 0: /mnt/users/accounting
mount fstype, device 0: ext2
mount options, device 0: rw,nosuid,sync
force unmount, device 0: yes
samba share, device 0: samba
Add samba_acct service as shown? (yes/no/?) yes

3
.配制第二个节点

•
拷贝 /etc/samba/smb.conf.xxx.
• mkdir /var/cache/samba/samba

4
.配制 windows 客户端访问

Linux 端为 windows 用户建立帐户 useradd xxx

touch /etc/samba/smbpasswd

smbpasswd –a xxx

5
.管理和测试 Cluster

a.
Samba node1 上运行时,你可以在 node2 执行 Cluadmin –>;service show
service relocate xxxx
这个时候服务和 IP 地址都应转移到 node2

b.
假设 node1 是主节点 , 你将服务成功转移到 node2 后,然后重启 node1 ,如果服务自动重新转移到 nose1 。恭喜你,一个基本的 cluster 服务完成了。


六、可能遇到的问题

问题:不能初始化 Quorum 分区。

在分区后应立即从启系统,以便能识别新的分区,同时确保不要建立文件系统在 Quorum HOSTS 文件内容是否与主机名匹配。

问题:在建立 Samba 的服务时没有成功。

共享分区没有创建文件系统。

问题:移掉一块网卡后, Cluster 不能启动。

因为 IP 地址改变,造成与 quorum 中不一致,更该 IP 地址与 quorum 相匹配。

问题:是否可以在 PV660F CX400/CX600 上实现。

这个还需要各位去实践,但我个人认为应该没有问题,只是在分配硬盘给 Linux 的步骤上有一些小的差别。

七、相关资料

[url]http://www.redhat.com/docs/manuals/advserver/[/url]

[url]http://www.redhat.com/docs/manuals/haserver/[/url]

八、补充

NFS
服务

在配置 NFS 是不需要手工建立 locking 目录,因为 NFS 文件 lock 不会由 cluster 服务来管理,它由系统文件自身来完成。

在两个节点上分别运行 NFS 服务
例: chkconfig nfs on
service nfs start
在其中一个节点上运行 cluadmin-àservice add nfs