Linux Cluster
2024-07-21 02:35:43
供稿:網友
在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,其他應用服務的建立,