日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

红帽集群RHCS

發(fā)布時間:2023/11/29 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 红帽集群RHCS 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1、簡介:

RHCS是RedHatClusterSuite的縮寫,也就是紅帽子集群套件,RHCS是一個能夠提供高可用性、高可靠性、負(fù)載均衡、存儲共享且經(jīng)濟廉價的集群工具集合,它將集群系統(tǒng)中三大集群架構(gòu)融合一體,可以給web應(yīng)用、數(shù)據(jù)庫應(yīng)用等提供安全、穩(wěn)定的運行環(huán)境。

特點:可以100多臺機器作為節(jié)點

? ? ?服務(wù)不需要集群軟件

? ? ?共享存儲是有用的,不是必須的

? ? ?網(wǎng)絡(luò)電源切換需要為多機器服務(wù)

紅帽集群套件進(jìn)程:

這是RHCS集群的一個基礎(chǔ)套件,提供一個集群的基本功能,使各個節(jié)點組成集群在一起工作,具體包含分布式集群管理器(CMAN)、成員關(guān)系管理、鎖管理(DLM)、配置文件管理(CCS)、柵設(shè)備(FENCE)。

集群配置系統(tǒng):ccsdcluster configure system

高可用管理:aisexec:集群建通信、成員管理

? ? ? ? ? ?Rgmanager:集群資源管理

共享存儲:dlm:分布式鎖機制

部署:lucisystem-config-cluster方式配集群

配置文件:

/etc/cluster/cluster.conf

2、RHCS紅帽集群部署

2.1 配置yum

1、配置centos

如果可以聯(lián)網(wǎng),我們可以使用centsos源來進(jìn)行yum安裝

#vi /etc/yum.conf

[base]

name=Red Hat Enterprise Linux $releasever -Base

baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/$basearch/

gpgcheck=1

[update]

name=Red Hat Enterprise Linux $releasever -Updates

baseurl=http://ftp.twaren.net/Linux/CentOS/5/updates/$basearch/

gpgcheck=1

[extras]

name=Red Hat Enterprise Linux $releasever -Extras

baseurl=http://ftp.twaren.net/Linux/CentOS/5/extras/$basearch/

gpgcheck=1

[addons]

name=Red Hat Enterprise Linux $releasever -Addons

baseurl=http://ftp.twaren.net/Linux/CentOS/5/addons/$basearch/

gpgcheck=1


Yum install scsi-target*

RHA5上用yum安裝程序時候,出現(xiàn)下面的異常問題:
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897 ?
RHA5

解決辦法:

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

如果是低版本,可以使用

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-centos4


如果本地沒有聯(lián)網(wǎng),則可以配置一個本地光盤yum

#vi /etc/yum.conf

[Base] ?

name=RHEL5 ISO Base ?

baseurl=file:///media/cdrom/Server ?

enabled=1

gpgcheck=0

[Cluster] ?

name=RHEL5 ISO Cluster ?

baseurl=file:///media/cdrom/Cluster ?

enabled=1

gpgcheck=0

2.2部署集群軟件

Yum install ricci

Chkconfig ricci on

Service ricci restart

Yum install luci ? ? ? ? ? ? ? ? ? 配置管理節(jié)軟件luci

[root@localhost iscsi]# luci_admin init ? ?設(shè)置luci密碼

Initializing the luci server

Creating the 'admin' user

Enter password:

Confirm password:

Please wait...

The admin password has been successfully set.

Generating SSL certificates...

The luci server has been successfully initialized


You must restart the luci server for changes to take effect.

Run "service luci restart" to do so

#chkconfig luci on

#service luci restart

[root@localhost iscsi]# service luci restart

Shutting down luci: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[確定]

Starting luci: Generating https SSL certificates... ?done

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [確定]

Point your web browser to https://ipap.128:8084 to access luci

2.3配置集群套件

https://管理ip:8084

集群-》創(chuàng)建新集群,輸入主機名和密碼

單擊提交,它就開始在節(jié)點進(jìn)行軟件安裝和部署,成功后再集群列表里便可以看到創(chuàng)建的集群,并可以進(jìn)行集群的開啟和停止與解散。

如果出現(xiàn)如下錯誤,則確認(rèn)hosts文件和防火墻與selinux是否關(guān)閉。

#chkconfig rgmanager on ? ?這是一個可選組件,開啟資源管理

#service rgmanager restart

切換到集群的節(jié)點,可以看到幾個功能框

Fence是一個虛擬的,分別在集群下面配置自己的fence

Add a failover domain,設(shè)置優(yōu)先級,如果優(yōu)先級高的會優(yōu)先,一般設(shè)為一樣,不讓隨便跑。

Add a sharable fence device,選擇一個fence卡,切換機制。


2.4配置集群服務(wù)

配置一個ip:集群-》增加一個集群ip

添加資源:輸入資源名,路徑和磁盤為同一磁盤

配置服務(wù):集群-》配置一個服務(wù)

選擇服務(wù)名,選擇切換域,選擇輪訓(xùn)策略,這里選擇relocate輪訓(xùn)。

通過單擊add resource to this service,選擇我們剛剛建立的資源,配置完畢在服務(wù)頁開啟開啟服務(wù)。

2.5 集群測試

Ping ?192.168.68.130 ? ? 虛擬的出的服務(wù)ip

#clustat -i 1 ? 查看集群狀態(tài)

Cluster Status for cluster1 @ Mon Dec 16 15:35:51 2013

Member Status: Quorate


Member Name ? ? ? ? ? ? ? ? ? ? ? ? ? ID ? Status

------ ---- ? ? ? ? ? ? ? ? ? ? ? ? ? ---- ------

192.168.68.128 ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 Online, Local, rgmanager

192.168.68.129 ? ? ? ? ? ? ? ? ? ? ? ? ? ?2 Online, rgmanager


Service Name ? ? ? ? ? ? ? ? Owner (Last) ? ? ? ? ? ? ? ? State ? ? ? ?

------- ---- ? ? ? ? ? ? ? ? ----- ------ ? ? ? ? ? ? ? ? ----- ? ? ? ?

service:httpd ? ? ? ? ? ? ? ?192.168.68.128 ? ? ? ? ? ? ? started ? ?

#ip addr list ?查看ip狀態(tài)

[root@localhost rc.d]# ip addr list

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue

? ?link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

? ?inet 127.0.0.1/8 scope host lo

? ?inet6 ::1/128 scope host

? ? ? valid_lft forever preferred_lft forever

2: peth0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000

? ?link/ether fe:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff

? ?inet6 fe80::fcff:ffff:feff:ffff/64 scope link

? ? ? valid_lft forever preferred_lft forever

我們可以通過圖形界面更改服務(wù)ip

#Clustat -i 1

Cluster Status for cluster1 @ Mon Dec 16 15:39:16 2013

Member Status: Quorate


Member Name ? ? ? ? ? ? ? ? ? ? ? ? ? ID ? Status

------ ---- ? ? ? ? ? ? ? ? ? ? ? ? ? ---- ------

192.168.68.128 ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 Online, Local, rgmanager

192.168.68.129 ? ? ? ? ? ? ? ? ? ? ? ? ? ?2 Online, rgmanager


Service Name ? ? ? ? ? ? ? ? Owner (Last) ? ? ? ? ? ? ? ? State ? ? ? ?

------- ---- ? ? ? ? ? ? ? ? ----- ------ ? ? ? ? ? ? ? ? ----- ? ? ? ?

service:httpd ? ? ? ? ? ? ? ?192.168.68.129 ? ? ? ? ? ? ? started ?

2.6 Sys-config-clustert使用

這是一個早期的RHCS配置工具,我們首先再管理節(jié)點

Yum install sys-config-cluster安裝該工具

Yum install cman

Yum install rmanger

然后cp /etc/cluseter/cluster.conf 到所有節(jié)點

Chkconfig cman on

Chkconfig rgmanger on

Service cman start

Service rgmanager start

然后sys-config-clusetr開始配置即可

3.1RHCS共享存儲配置

RHCS可以通過iscsi使用共享存儲,提高磁盤容量和工作效率。

Udev是一個策略,它使得linux對磁盤的識別變得簡單。

Iscsi使用tcp/ip協(xié)議,可以掛載共享存儲。

3.1配置iscsi服務(wù)器端

Yum install scsi-target*

Chkconfig tgtd on

Service tgtd start

root@localhost yum.repos.d]# fdisk /dev/hdb ? ?磁盤分區(qū)

The number of cylinders for this disk is set to 8322.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

? (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n

Command action

? l ? logical (5 or over)

? p ? primary partition (1-4)

l ?

First cylinder (6403-8322, default 6403):

Using default value 6403

Last cylinder or +size or +sizeM or +sizeK (6403-8322, default 8322): +500MB

Command (m for help): p


Disk /dev/hdb: 4294 MB, 4294967296 bytes

16 heads, 63 sectors/track, 8322 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes


? Device Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System

/dev/hdb1 ? ? ? ? ? ? ? 1 ? ? ? ?8322 ? ? 4194256+ ? 5 ?Extended

/dev/hdb5 ? ? ? ? ? ? ? 1 ? ? ? ? 195 ? ? ? 98217 ? 8e ?Linux LVM

/dev/hdb6 ? ? ? ? ? ? 196 ? ? ? ? 390 ? ? ? 98248+ ?8e ?Linux LVM

/dev/hdb7 ? ? ? ? ? ? 391 ? ? ? ? 585 ? ? ? 98248+ ?8e ?Linux LVM

/dev/hdb8 ? ? ? ? ? ? 586 ? ? ? ?2524 ? ? ?977224+ ?8e ?Linux LVM

/dev/hdb9 ? ? ? ? ? ?2525 ? ? ? ?4463 ? ? ?977224+ ?8e ?Linux LVM

/dev/hdb10 ? ? ? ? ? 4464 ? ? ? ?6402 ? ? ?977224+ ?8e ?Linux LVM

/dev/hdb11 ? ? ? ? ? 6403 ? ? ? ?7372 ? ? ?488848+ ?83 ?Linux


Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.


WARNING: Re-reading the partition table failed with error 16: 設(shè)備或資源忙.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

[root@localhost yum.repos.d]# partprobe /dev/hdb

[root@ipap ~]# mkfs.ext3 /dev/hdb11 ? ?格式化磁盤

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

122400 inodes, 488848 blocks

24442 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67633152

60 block groups

8192 blocks per group, 8192 fragments per group

2040 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409


Writing inode tables: done ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 28 mounts or

180 days, whichever comes first. ?Use tune2fs -c or -i to override.

[root@ipap ~]# mkfs.gfs2 -p lock_dlm -t cluster1:my-gfs2 -j 4 /dev/hdb11 ? ?

This will destroy any data on /dev/hdb11.

?It appears to contain a ext3 filesystem.


Are you sure you want to proceed? [y/n] y

3.2 創(chuàng)建掛載目標(biāo)

創(chuàng)建掛載磁盤

#tgtadm --lld iscsi --op new --mode target --tid 1 -T ipap.2013-12.disk1

分配邏輯單元

#tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hdb11

分配權(quán)限

tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.68.129

寫入開機腳本

history |tail -n 4 >>/etc/rc.d/rc.local

Vi /etc/rc.d/rc.local ? 修改開機腳本

顯示配置文件

[root@localhost yum.repos.d]# tgtadm --lld iscsi --mode target --op show

Target 1: ipap.2013-12.disk1

? ?System information:

? ? ? ?Driver: iscsi

? ? ? ?State: ready

? ?I_T nexus information:

? ?LUN information:

? ? ? ?LUN: 0

? ? ? ? ? ?Type: controller

? ? ? ? ? ?SCSI ID: IET ? ? 00010000

? ? ? ? ? ?SCSI SN: beaf10

? ? ? ? ? ?Size: 0 MB, Block size: 1

? ? ? ? ? ?Online: Yes

? ? ? ? ? ?Removable media: No

? ? ? ? ? ?Readonly: No

? ? ? ? ? ?Backing store type: null

? ? ? ? ? ?Backing store path: None

? ? ? ? ? ?Backing store flags:

? ? ? ?LUN: 1

? ? ? ? ? ?Type: disk

? ? ? ? ? ?SCSI ID: IET ? ? 00010001

? ? ? ? ? ?SCSI SN: beaf11

? ? ? ? ? ?Size: 501 MB, Block size: 512

? ? ? ? ? ?Online: Yes

? ? ? ? ? ?Removable media: No

? ? ? ? ? ?Readonly: No

? ? ? ? ? ?Backing store type: rdwr

? ? ? ? ? ?Backing store path: /dev/hdb11

? ? ? ? ? ?Backing store flags:

? ?Account information:

? ?ACL information:

? ? ? ?192.168.68.129

You have new mail in /var/spool/mail/root

授權(quán)模式

/etc/iscsi/iscsid.conf配置文件

#node.session.auth.authmethod = CHAP

#node.session.auth.username = username

#node.session.auth.password = password

[root@localhost iscsi]# chkconfig iscsi on

[root@localhost iscsi]# service iscsi restart

Stopping iSCSI daemon: iscsiadm: can not connect to iSCSI daemon (111)!

iscsiadm: initiator reported error (20 - could not connect to iscsid)

iscsiadm: Could not stop iscsid. Trying sending iscsid SIGTERM or SIGKILL signals manually



iscsid 已停 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[確定]

Turning off network shutdown. Starting iSCSI daemon: ? ? ? ? ? ? [確定]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [確定]

設(shè)置 iSCSI 目標(biāo):iscsiadm: No records found!

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [確定]

3.3 配置iscsi客戶端:

rpm -ivh iscsi-initiator-utils-6.2.0.871-0.10.el5.x86_64.rpm

發(fā)現(xiàn)介質(zhì)

[root@localhost ~]# iscsiadm -m discovery -t sendtargets -p 192.168.68.128:3260192.168.68.128:3260,1 ipap.2013-12.disk1

掛載介質(zhì)

[root@localhost ~]# iscsiadm -m node -T ipap.2013-12.disk1 -p 192.168.68.128:3260 -l

Logging in to [iface: default, target: ipap.2013-12.disk1, portal: 192.168.68.128,3260]

Login to [iface: default, target: ipap.2013-12.disk1, portal: 192.168.68.128,3260]: successful

[root@localhost ~]# fdisk -l


Disk /dev/hda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


? Device Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System

/dev/hda1 ? * ? ? ? ? ? 1 ? ? ? ? ?13 ? ? ?104391 ? 83 ?Linux

/dev/hda2 ? ? ? ? ? ? ?14 ? ? ? ?1044 ? ? 8281507+ ?8e ?Linux LVM


Disk /dev/sda: 500 MB, 500580864 bytes

16 heads, 60 sectors/track, 1018 cylinders

Units = cylinders of 960 * 512 = 491520 bytes


Disk /dev/sda doesn't contain a valid partition table

刪除介質(zhì)

[root@localhost ~]# iscsiadm -m node -T ipap.2013-12.disk1 -p 192.168.68.128:3260 -u

[root@localhost ~]#Iscsiadm ?-m node -o delete -T ipap.2013-12.disk1 -p 192.168.68.128:3260

3.4 RHCS使用共享介質(zhì)

在一個多節(jié)點的RHCS集群系統(tǒng)中,一個節(jié)點失敗后,集群的服務(wù)和資源可以自動轉(zhuǎn)移到其它節(jié)點上,但是這種轉(zhuǎn)移是有條件的,例如,在一個四節(jié)點的集群中,一旦有兩個節(jié)點發(fā)生故障,整個集群系統(tǒng)將會掛起,集群服務(wù)也隨即停止,而如果配置了存儲集群GFS文件系統(tǒng),那么只要有一個節(jié)點發(fā)生故障,所有節(jié)點掛載的GFS文件系統(tǒng)將hung住。此時共享存儲將無法使用,這種情況的出現(xiàn),對于高可用的集群系統(tǒng)來說是絕對不允許的,解決這種問題就要通過表決磁盤來實現(xiàn)了。

mkdisk是一個集群仲裁磁盤工具集,可以用來創(chuàng)建一個qdisk

共享磁盤也可以查看共享磁盤的狀態(tài)信息。mkqdisk操作只能創(chuàng)建16

個節(jié)點的投票空間,Heuristics就是這么一個擴充選項,它允許通過第三方應(yīng)用程序來輔助定位節(jié)點狀態(tài),常用的有ping網(wǎng)關(guān)或路由,或者通過腳本程序等,如果試探失敗,qdiskd會認(rèn)為此節(jié)點失敗,進(jìn)而試圖重啟此節(jié)點,以使節(jié)點進(jìn)入正常狀態(tài)。

待續(xù)……



總結(jié)

以上是生活随笔為你收集整理的红帽集群RHCS的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。