RedHat下建立群集
生活随笔
收集整理的這篇文章主要介紹了
RedHat下建立群集
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
注明:本安裝步驟不是Dell的標(biāo)準(zhǔn)文檔,不能直接發(fā)給客戶,僅供學(xué)習(xí)參考。
環(huán)境說(shuō)明:
1. 硬件:
說(shuō)明:按照標(biāo)準(zhǔn)至少需要4塊網(wǎng)卡和其他相應(yīng)硬件,但因?yàn)闂l件限制,故在硬件和設(shè)置上做了一些變通。
服務(wù)器:PE4300、PE4600
網(wǎng)卡:兩個(gè)
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 這個(gè)地址不同于Microsoft下的Cluster server IP address,該地址是用于管理上用的。
基本步驟:
一、安裝OS
說(shuō)明:為了安裝可以順利進(jìn)行,建議先移掉RAID卡,否則在拷貝完文件后系統(tǒng)不能正常啟動(dòng)。因?yàn)?#xff0c;當(dāng)使用插卡(RAID/SCSI)連接外置磁盤(pán)柜,它們將總是優(yōu)先于本地硬盤(pán)被檢測(cè),這個(gè)將導(dǎo)致本地的盤(pán)符被改變。
按照通常的步驟安裝OS,在系統(tǒng)安裝完后,將RAID或SCSI卡插回主機(jī),在下次重啟時(shí)系統(tǒng)將自動(dòng)發(fā)現(xiàn)新設(shè)備。但為了保證在每次系統(tǒng)引導(dǎo)時(shí)該設(shè)備能自動(dòng)啟動(dòng),你仍需做以下兩步:
a. 編輯 /etc/modules.conf文件,同時(shí)增加下面內(nèi)容到文件內(nèi)容中
alias scsi_hostadapter megaraid
options scsi_mod max_scsi_luns=255 à可提前增加這一行,因?yàn)橛泄蚕泶疟P(pán)柜存
在,并且有多個(gè)LUN在上面時(shí),系統(tǒng)要求這樣做。
b. 執(zhí)行
Mkinitrd initrd-2.4.9-e.3smp.img 2.4.9-e.3smp à這行的內(nèi)容主要還是由內(nèi)核來(lái)決定。
例:
/etc/modules.conf:
alias scsi_hostadapter megaraid
options scsi_mod max_scsi_luns=255
二、物理連接
這部份的步驟與W2K一樣,即先用一個(gè)節(jié)點(diǎn)配制LUN,另一個(gè)節(jié)點(diǎn)從磁盤(pán)讀LUN配制,同時(shí)保證2塊RAID卡的Cluster功能開(kāi)啟,SCSI ID 不能沖突,同時(shí)將PV220S的開(kāi)關(guān)撥動(dòng)到Cluster模式。
三、安裝和配制分區(qū)
1.建立分驅(qū)
說(shuō)明:建議在此時(shí)只開(kāi)一個(gè)節(jié)點(diǎn)。在系統(tǒng)啟動(dòng)后,系統(tǒng)可以識(shí)別在磁盤(pán)柜上新建的LUN。設(shè)備名通常是在本地硬盤(pán)后順序編排。例如:當(dāng)本地是/dev/sda,那么新的設(shè)備是/dev/sdb
分區(qū)的原則和要求:Quorum分區(qū)的要求:不能小于10M,必須是裸設(shè)備,不能有文件系統(tǒng)。
Quorum分區(qū)只能用于Cluster的狀態(tài)和配制信息。
Quorum要求兩個(gè)分區(qū),一個(gè)為primary,另一個(gè)為slave
Cluster 應(yīng)用服務(wù)的分區(qū):要求一個(gè)cluster服務(wù)一個(gè)分區(qū)。例如:你想有SQL、NFS、SAMBA三個(gè)Cluster應(yīng)用服務(wù),那么你必須為三個(gè)服務(wù)各建一個(gè)分區(qū)。
例:fdisk /dev/sdb 創(chuàng)建新的分區(qū)
/dev/sdb1 àQuorum primary partition
/dev/sdb2 àQuorum slave partition
/dev/sdb3 àSql partition
/dev/sdb4 àNFS partition
/dev/sdb5 àsamba partition
注意:在創(chuàng)建完分驅(qū)后,一定要重啟主機(jī),建議重啟所有設(shè)備。
2.建立文件系統(tǒng)――即格式化分區(qū)
說(shuō)明:Quorum 必須是裸設(shè)備,所以不需要格式化。但其他分區(qū)必須格式化,同時(shí)將默認(rèn)的Block塊大小增大到4096,默認(rèn)為1024。
例:
mkfs –t ext2 –j –b 4096 /dev/sdbx –-》X代表分區(qū)
3.為Cluster 創(chuàng)建Quorum分區(qū)
說(shuō)明:使用命令 cat /proc/devices 確認(rèn)系統(tǒng)是否支持裸設(shè)備,如果你看到下面的輸出,說(shuō)明系統(tǒng)可以支持裸設(shè)備。
162 raw
在兩臺(tái)服務(wù)器上分別編輯/etc/sysconfig/rawdevices文件,以便將分區(qū)綁定到裸設(shè)備。
例: /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
重啟服務(wù) service rawdevices restart
4.檢查和驗(yàn)證Quoram分區(qū)
在兩個(gè)節(jié)點(diǎn)上分別cludiskutil –p 確保兩個(gè)節(jié)點(diǎn)都能有以下輸出:
----- Shared State Header ------
Magic# = 0x39119fcd
Version = 1
Updated on Thu Sep 14 05:43:18 2000
Updated by node 0
四、建立Cluster服務(wù)
說(shuō)明:確保所有網(wǎng)卡正常工作。同時(shí),設(shè)置基本的網(wǎng)絡(luò)要求。
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.運(yùn)行/sbin/cluconfig
說(shuō)明:系統(tǒng)將自動(dòng)生成cluster的配制文件/etc/cluster.conf,這一步只需要在其中一個(gè)節(jié)點(diǎn)上運(yùn)行。
你將看到以下輸出:
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.配制第二個(gè)節(jié)點(diǎn)
只需執(zhí)行 cluconfig --init=/dev/raw/raw1
4.啟動(dòng)Cluster服務(wù)
分別在兩個(gè)節(jié)點(diǎn)上執(zhí)行 service cluster start
你將看到下面的幾個(gè)Daemon
• cluquorumd — Quorum daemon
• clusvcmgrd — Service manager daemon
• clupowerd — Power daemon
• cluhbd — Heartbeat daemon
• clumibd — Administrative system monitoring daemon
五、建立Cluster應(yīng)用服務(wù)
說(shuō)明:本次實(shí)驗(yàn)只測(cè)試了Samba,其他應(yīng)用服務(wù)的建立,請(qǐng)參考RedHat 文檔。
.
1.Samba
說(shuō) 明:Samba在cluster的環(huán)境下與單機(jī)有一些不同,首先是配制文件的改變,不在是/etc/samba/smb.conf,而是/etc /samba/smb.conf.xxxàxxx代表你的共享名字,可以是任何字母。Samba在cluster環(huán)境下需要自己的locking目錄 /var/cache/samba/xxxx
2. 運(yùn)行/sbin/cluadmin
說(shuō)明:只需要在其中一個(gè)節(jié)點(diǎn)執(zhí)行該命令,當(dāng)你執(zhí)行上面的命令你將看到以下輸出:
Service name: samba à所有黑色字體代表手工輸入接受其默認(rèn)值
Preferred member??None :Node1 à這行代表Samba服務(wù)將默認(rèn)在node1上運(yùn)行。
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服務(wù)運(yùn)行的IP地址,即windows客戶端訪問(wèn)輸入的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客戶端在網(wǎng)上鄰居看到的名字。
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.配制第二個(gè)節(jié)點(diǎn)
• 拷貝 /etc/samba/smb.conf.xxx.
• mkdir /var/cache/samba/samba
4.配制windows客戶端訪問(wèn)
在Linux端為windows用戶建立帳戶 useradd xxx
touch /etc/samba/smbpasswd
smbpasswd –a xxx
5.管理和測(cè)試Cluster
a. 當(dāng)Samba在node1上運(yùn)行時(shí),你可以在node2執(zhí)行Cluadmin –>;service show
service relocate xxxx
這個(gè)時(shí)候服務(wù)和IP地址都應(yīng)轉(zhuǎn)移到node2。
b. 假設(shè)node1是主節(jié)點(diǎn),你將服務(wù)成功轉(zhuǎn)移到node2后,然后重啟node1,如果服務(wù)自動(dòng)重新轉(zhuǎn)移到nose1。恭喜你,一個(gè)基本的cluster服務(wù)完成了。
六、可能遇到的問(wèn)題
問(wèn)題:不能初始化Quorum分區(qū)。
在分區(qū)后應(yīng)立即從啟系統(tǒng),以便能識(shí)別新的分區(qū),同時(shí)確保不要建立文件系統(tǒng)在Quorum和HOSTS文件內(nèi)容是否與主機(jī)名匹配。
問(wèn)題:在建立Samba的服務(wù)時(shí)沒(méi)有成功。
共享分區(qū)沒(méi)有創(chuàng)建文件系統(tǒng)。
問(wèn)題:移掉一塊網(wǎng)卡后,Cluster不能啟動(dòng)。
因?yàn)?/span>IP地址改變,造成與quorum中不一致,更該IP地址與quorum相匹配。
問(wèn)題:是否可以在PV660F和CX400/CX600上實(shí)現(xiàn)。
這個(gè)還需要各位去實(shí)踐,但我個(gè)人認(rèn)為應(yīng)該沒(méi)有問(wèn)題,只是在分配硬盤(pán)給Linux的步驟上有一些小的差別。
七、相關(guān)資料
[url]http://www.redhat.com/docs/manuals/advserver/[/url]
[url]http://www.redhat.com/docs/manuals/haserver/[/url]
八、補(bǔ)充
NFS 服務(wù)
在配置NFS是不需要手工建立locking目錄,因?yàn)?/span>NFS文件lock不會(huì)由cluster服務(wù)來(lái)管理,它由系統(tǒng)文件自身來(lái)完成。
在兩個(gè)節(jié)點(diǎn)上分別運(yùn)行NFS服務(wù)
例:chkconfig nfs on
service nfs start
在其中一個(gè)節(jié)點(diǎn)上運(yùn)行cluadmin-àservice add nfs
環(huán)境說(shuō)明:
1. 硬件:
說(shuō)明:按照標(biāo)準(zhǔn)至少需要4塊網(wǎng)卡和其他相應(yīng)硬件,但因?yàn)闂l件限制,故在硬件和設(shè)置上做了一些變通。
服務(wù)器:PE4300、PE4600
網(wǎng)卡:兩個(gè)
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 這個(gè)地址不同于Microsoft下的Cluster server IP address,該地址是用于管理上用的。
基本步驟:
一、安裝OS
說(shuō)明:為了安裝可以順利進(jìn)行,建議先移掉RAID卡,否則在拷貝完文件后系統(tǒng)不能正常啟動(dòng)。因?yàn)?#xff0c;當(dāng)使用插卡(RAID/SCSI)連接外置磁盤(pán)柜,它們將總是優(yōu)先于本地硬盤(pán)被檢測(cè),這個(gè)將導(dǎo)致本地的盤(pán)符被改變。
按照通常的步驟安裝OS,在系統(tǒng)安裝完后,將RAID或SCSI卡插回主機(jī),在下次重啟時(shí)系統(tǒng)將自動(dòng)發(fā)現(xiàn)新設(shè)備。但為了保證在每次系統(tǒng)引導(dǎo)時(shí)該設(shè)備能自動(dòng)啟動(dòng),你仍需做以下兩步:
a. 編輯 /etc/modules.conf文件,同時(shí)增加下面內(nèi)容到文件內(nèi)容中
alias scsi_hostadapter megaraid
options scsi_mod max_scsi_luns=255 à可提前增加這一行,因?yàn)橛泄蚕泶疟P(pán)柜存
在,并且有多個(gè)LUN在上面時(shí),系統(tǒng)要求這樣做。
b. 執(zhí)行
Mkinitrd initrd-2.4.9-e.3smp.img 2.4.9-e.3smp à這行的內(nèi)容主要還是由內(nèi)核來(lái)決定。
例:
/etc/modules.conf:
alias scsi_hostadapter megaraid
options scsi_mod max_scsi_luns=255
二、物理連接
這部份的步驟與W2K一樣,即先用一個(gè)節(jié)點(diǎn)配制LUN,另一個(gè)節(jié)點(diǎn)從磁盤(pán)讀LUN配制,同時(shí)保證2塊RAID卡的Cluster功能開(kāi)啟,SCSI ID 不能沖突,同時(shí)將PV220S的開(kāi)關(guān)撥動(dòng)到Cluster模式。
三、安裝和配制分區(qū)
1.建立分驅(qū)
說(shuō)明:建議在此時(shí)只開(kāi)一個(gè)節(jié)點(diǎn)。在系統(tǒng)啟動(dòng)后,系統(tǒng)可以識(shí)別在磁盤(pán)柜上新建的LUN。設(shè)備名通常是在本地硬盤(pán)后順序編排。例如:當(dāng)本地是/dev/sda,那么新的設(shè)備是/dev/sdb
分區(qū)的原則和要求:Quorum分區(qū)的要求:不能小于10M,必須是裸設(shè)備,不能有文件系統(tǒng)。
Quorum分區(qū)只能用于Cluster的狀態(tài)和配制信息。
Quorum要求兩個(gè)分區(qū),一個(gè)為primary,另一個(gè)為slave
Cluster 應(yīng)用服務(wù)的分區(qū):要求一個(gè)cluster服務(wù)一個(gè)分區(qū)。例如:你想有SQL、NFS、SAMBA三個(gè)Cluster應(yīng)用服務(wù),那么你必須為三個(gè)服務(wù)各建一個(gè)分區(qū)。
例:fdisk /dev/sdb 創(chuàng)建新的分區(qū)
/dev/sdb1 àQuorum primary partition
/dev/sdb2 àQuorum slave partition
/dev/sdb3 àSql partition
/dev/sdb4 àNFS partition
/dev/sdb5 àsamba partition
注意:在創(chuàng)建完分驅(qū)后,一定要重啟主機(jī),建議重啟所有設(shè)備。
2.建立文件系統(tǒng)――即格式化分區(qū)
說(shuō)明:Quorum 必須是裸設(shè)備,所以不需要格式化。但其他分區(qū)必須格式化,同時(shí)將默認(rèn)的Block塊大小增大到4096,默認(rèn)為1024。
例:
mkfs –t ext2 –j –b 4096 /dev/sdbx –-》X代表分區(qū)
3.為Cluster 創(chuàng)建Quorum分區(qū)
說(shuō)明:使用命令 cat /proc/devices 確認(rèn)系統(tǒng)是否支持裸設(shè)備,如果你看到下面的輸出,說(shuō)明系統(tǒng)可以支持裸設(shè)備。
162 raw
在兩臺(tái)服務(wù)器上分別編輯/etc/sysconfig/rawdevices文件,以便將分區(qū)綁定到裸設(shè)備。
例: /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
重啟服務(wù) service rawdevices restart
4.檢查和驗(yàn)證Quoram分區(qū)
在兩個(gè)節(jié)點(diǎn)上分別cludiskutil –p 確保兩個(gè)節(jié)點(diǎn)都能有以下輸出:
----- Shared State Header ------
Magic# = 0x39119fcd
Version = 1
Updated on Thu Sep 14 05:43:18 2000
Updated by node 0
四、建立Cluster服務(wù)
說(shuō)明:確保所有網(wǎng)卡正常工作。同時(shí),設(shè)置基本的網(wǎng)絡(luò)要求。
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.運(yùn)行/sbin/cluconfig
說(shuō)明:系統(tǒng)將自動(dòng)生成cluster的配制文件/etc/cluster.conf,這一步只需要在其中一個(gè)節(jié)點(diǎn)上運(yùn)行。
你將看到以下輸出:
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.配制第二個(gè)節(jié)點(diǎn)
只需執(zhí)行 cluconfig --init=/dev/raw/raw1
4.啟動(dòng)Cluster服務(wù)
分別在兩個(gè)節(jié)點(diǎn)上執(zhí)行 service cluster start
你將看到下面的幾個(gè)Daemon
• cluquorumd — Quorum daemon
• clusvcmgrd — Service manager daemon
• clupowerd — Power daemon
• cluhbd — Heartbeat daemon
• clumibd — Administrative system monitoring daemon
五、建立Cluster應(yīng)用服務(wù)
說(shuō)明:本次實(shí)驗(yàn)只測(cè)試了Samba,其他應(yīng)用服務(wù)的建立,請(qǐng)參考RedHat 文檔。
.
1.Samba
說(shuō) 明:Samba在cluster的環(huán)境下與單機(jī)有一些不同,首先是配制文件的改變,不在是/etc/samba/smb.conf,而是/etc /samba/smb.conf.xxxàxxx代表你的共享名字,可以是任何字母。Samba在cluster環(huán)境下需要自己的locking目錄 /var/cache/samba/xxxx
2. 運(yùn)行/sbin/cluadmin
說(shuō)明:只需要在其中一個(gè)節(jié)點(diǎn)執(zhí)行該命令,當(dāng)你執(zhí)行上面的命令你將看到以下輸出:
Service name: samba à所有黑色字體代表手工輸入接受其默認(rèn)值
Preferred member??None :Node1 à這行代表Samba服務(wù)將默認(rèn)在node1上運(yùn)行。
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服務(wù)運(yùn)行的IP地址,即windows客戶端訪問(wèn)輸入的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客戶端在網(wǎng)上鄰居看到的名字。
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.配制第二個(gè)節(jié)點(diǎn)
• 拷貝 /etc/samba/smb.conf.xxx.
• mkdir /var/cache/samba/samba
4.配制windows客戶端訪問(wèn)
在Linux端為windows用戶建立帳戶 useradd xxx
touch /etc/samba/smbpasswd
smbpasswd –a xxx
5.管理和測(cè)試Cluster
a. 當(dāng)Samba在node1上運(yùn)行時(shí),你可以在node2執(zhí)行Cluadmin –>;service show
service relocate xxxx
這個(gè)時(shí)候服務(wù)和IP地址都應(yīng)轉(zhuǎn)移到node2。
b. 假設(shè)node1是主節(jié)點(diǎn),你將服務(wù)成功轉(zhuǎn)移到node2后,然后重啟node1,如果服務(wù)自動(dòng)重新轉(zhuǎn)移到nose1。恭喜你,一個(gè)基本的cluster服務(wù)完成了。
六、可能遇到的問(wèn)題
問(wèn)題:不能初始化Quorum分區(qū)。
在分區(qū)后應(yīng)立即從啟系統(tǒng),以便能識(shí)別新的分區(qū),同時(shí)確保不要建立文件系統(tǒng)在Quorum和HOSTS文件內(nèi)容是否與主機(jī)名匹配。
問(wèn)題:在建立Samba的服務(wù)時(shí)沒(méi)有成功。
共享分區(qū)沒(méi)有創(chuàng)建文件系統(tǒng)。
問(wèn)題:移掉一塊網(wǎng)卡后,Cluster不能啟動(dòng)。
因?yàn)?/span>IP地址改變,造成與quorum中不一致,更該IP地址與quorum相匹配。
問(wèn)題:是否可以在PV660F和CX400/CX600上實(shí)現(xiàn)。
這個(gè)還需要各位去實(shí)踐,但我個(gè)人認(rèn)為應(yīng)該沒(méi)有問(wèn)題,只是在分配硬盤(pán)給Linux的步驟上有一些小的差別。
七、相關(guān)資料
[url]http://www.redhat.com/docs/manuals/advserver/[/url]
[url]http://www.redhat.com/docs/manuals/haserver/[/url]
八、補(bǔ)充
NFS 服務(wù)
在配置NFS是不需要手工建立locking目錄,因?yàn)?/span>NFS文件lock不會(huì)由cluster服務(wù)來(lái)管理,它由系統(tǒng)文件自身來(lái)完成。
在兩個(gè)節(jié)點(diǎn)上分別運(yùn)行NFS服務(wù)
例:chkconfig nfs on
service nfs start
在其中一個(gè)節(jié)點(diǎn)上運(yùn)行cluadmin-àservice add nfs
轉(zhuǎn)載于:https://blog.51cto.com/hukunlin/139617
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專(zhuān)家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的RedHat下建立群集的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [RHEL5企业级Linux服务攻略]-
- 下一篇: 大白汽车分期是什么