免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2343 | 回复: 0
打印 上一主题 下一主题

Linux Cluster [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-29 09:59 |只看该作者 |倒序浏览
在RedHat下建立群集
注明:本安装步骤不是Dell的标准文档,不能直接发给客户,仅供学习参考。  
环境说明:
1. 硬件:
说明:按照标准至少需要4块网卡和其他相应硬件,但因为条件限制,故在硬件和设置上做了一些变通。
服务器:PE4300、PE4600
网卡:两个
RAID:两块PERC2/SC
Storage:PV220S和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的步骤上有一些小的差别。
七、相关资料
http://www.redhat.com/docs/manuals/advserver/
http://www.redhat.com/docs/manuals/haserver/
八、补充
NFS 服务
在配置NFS是不需要手工建立locking目录,因为NFS文件lock不会由cluster服务来管理,它由系统文件自身来完成。
在两个节点上分别运行NFS服务
例:chkconfig nfs on
service nfs start
在其中一个节点上运行cluadmin-àservice add nfs


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26020/showart_222902.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP