主機:node
四臺linux Centos6.5主機python
網絡:mysql
Openstack.storage:IP1:152.55.249.64 RHCS管理和存儲節點linux
IP2:192.168.249.64web
Openstack.node1:IP1:152.55.249.65 業務1sql
IP2:192.168.249.65服務器
Openstack.node2: IP1:152.55.249.66 業務2網絡
IP2:192.168.249.65負載均衡
Openstack.node2: IP1:152.55.249.67 業務3dom
IP2:192.168.249.65
軟件:RHCS、iscsi-target、iscsi-initor
1、一臺RHCS管理主機管理三臺node節點,管理主機也負責存儲分配
實驗目的:經過RHCS集羣套件搭建GFS2集羣文件系統,保證不一樣節點可以同時對GFS2集羣文件系統進行讀取和寫入。
GFS2:全局文件系統第二版,GFS2是應用最普遍的集羣文件系統。它是由紅帽公司開發出來的,容許全部集羣節點並行訪問。元數據一般會保存在共享存儲設備或複製存儲設備的一個分區裏或邏輯卷中。
RHCS:RHCS(REDHAT CLUSTER SUITE)是一款可以提供高性能、高可靠性、負載均衡、高可用性的集羣工具集,一個集羣一般有兩個或兩個以上的計算機(稱爲「節點」或」成員「)共同執行一個任務。
LUCI:是一個基於web的集羣配置方式,經過luci能夠輕鬆的搭建一個功能強大的集羣系統。CLVM:Cluster邏輯卷管理,是LVM的擴展,這種擴展容許cluster中的機器使用LVM來管理共享存儲。CMAN:分佈式集羣管理器。
iSCSI(InternetSCSI)是2003年IETF(InternetEngineeringTask Force,互聯網工程任務組)制訂的一項標準,這種指令集合能夠實如今IP網絡上運行SCSI協議,使其可以在諸如高速千兆以太網上進行路由選擇。
GFS(Global File System):以本地文件系統的形式出現。多個Linux機器經過網絡共享存儲設備,每一臺機器均可以將網絡共享磁盤看做是本地磁盤,若是某臺機器對某個文件執行了寫操做,則後來訪問此文件的機器就會讀到寫之後的結果。
iSCSI的工做過程:當iSCSI主機應用程序發出數據讀寫請求後,操做系統會生成一個相應的SCSI命令,該SCSI命令在iSCSIInitiator層被封裝成iSCSI消息包並經過TCP/IP傳送到設備側,設備側的iSCSITarget層會解開iSCSI消息包,獲得SCSI命令的內容,而後傳送給SCSI設備執行;設備執行SCSI命令後的響應,在通過設備側iSCSITarget層時被封裝成iSCSI響應PDU,經過TCP/IP網絡傳送給主機的iSCSIInitiator層,iSCSInitiator會從iSCSI響應PDU裏解析出SCSI響應並傳送給操做系統,操做系統再響應給應用程序。要實現iSCSI讀寫,除了使用特定硬設備外,也可透過軟件方式,將服務器仿真爲iSCSI的發起端(Initiator)或目標端(target),利用既有的處理器與普通的以太網絡卡資源實現iSCSI的鏈接。
1、部署yum源並添加源:爲了減小軟件的依賴問題,最好創建yum源,能夠建一個網絡源也能夠是本地源,這裏再也不描述
Vi /etc/yum.repo/local.repo
[local_server]
name=this is local
baseurl=file:///mnt
enabled=1
gpgcheck=0
2、配置host文件
#cat /etc/sysconfig/network
HOSTNAME=manager
#cat /etc/hosts
52.55.249.64 openstack.manager
192.168.249.64 openstack.manager
#node
152.55.249.65 openstack.node1
192.168.249.66 openstack.node1
152.55.249.66 openstack.node2
192.168.249.66 openstack.node2
152.55.249.67 openstack.node3
192.168.249.67 openstack.node3
3、ssh互信
設置一臺管理端,將ssh公鑰、私鑰,將公鑰傳遞到全部節點上
Vi /etc/ssh/sshd_config
PermitRootLogin yes
[root@rh10 ~]# o
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
cf:a5:90:7b:91:0f:cd:f9:15:89:07:0a:d5:e9:56:ac root@rh10
The key's randomart p_w_picpath is:
+--[ RSA 2048]----+
| .....o |
| . .ooo.|
| ...o+ |
| . + E. .|
| S + * .|
| = * . . |
| . = . . |
| . |
| |
+-----------------+
[root@rh10 ~]# ssh-copy-id -i .ssh/id_rsa.pub node1
root@mysql6's password:
Now try logging into the machine, with "ssh 'mysql6'", andcheck in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@rh11 ~]# ssh-keygen -trsa -P ''
[root@rh11 ~]# ssh-copy-id -i .ssh/id_rsa.pub rh10
4、關閉NetworkManger
#Service NetworkManager stop
5.操做系統環境調整
1.)關閉防火牆
Service iptables stop
Chkconfig iptables off
2.)關閉Selinux
修改 /etc/sysconfig/selinux
SELINUX=disabled
生效命令:setenforce 0
3.)調整最大打開文件數65535
配置/etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
4.)調整最大進程數65536
/etc/security/limits.d/90-nproc.conf
* soft nproc 65536
5.)配置NTP
Ntpdate ntpserver- IP 若是有時間同步服務器
1)、安裝luci和ricci(管理端安裝luci,節點安裝ricci)
Luci是運行WEB樣式的Conga服務器端,它能夠經過web界面很容易管理整個RHCS集羣,每一步操做都會在/etc/cluster/cluster.conf生成相應的配置信息
[root@manager ~]# yum install luci –y //管理節點
注意:安裝luci會安裝不少python
[root@manager ~]#/etc/rc.d/init.d/luci start
dding following auto-detected host IDs (IP addresses/domain names),corresponding to `openstack.manager' address, to the configuration ofself-managed certificate `/var/lib/luci/etc/cacert.config' (you can change themby editing `/var/lib/luci/etc/cacert.config', removing the generated certificate`/var/lib/luci/certs/host.pem' and restarting luci):
(none suitable found, you can still do it manually as mentioned above)
Generating a 2048 bit RSA private key
writing new private key to '/var/lib/luci/certs/host.pem'
Starting saslauthd: [ OK ]
Start luci...
Point your web browser to https://openstack.manager:8084 (orequivalent) to access luci [root@node1 ~]#yuminstall ricci –y //業務節點
[root@node1 ~]#chkconfig ricci on && /etc/rc.d/init.d/riccistart
starting oddjobd: [ OK ]
generating SSL certificates... done
Generating NSS database... done
Starting ricci: [ OK ]
[root@node1 ~]#echo 'si-tech.com'| passwd ricci --stdin //配置集羣時使用
Changing password for user ricci.
passwd: all authentication tokens updated successfully.
https://openstack.manager:8084或者https://152.55.249.64:8084
添加節點node1/node2/node3,先設置3個,後期能夠增長節點,password爲各節點ricci的密碼,而後勾選「Download Packages」(在各節點yum配置好的基礎上,自動安裝cman和rgmanager及相關的依賴包,需提早都配置好yum),勾選「rebot nodes before joing cluster」安裝後會重啓,勾選「Enable Shared Storage Support」安裝存儲相關的包,並支持gfs2文件系統、DLM鎖、clvm邏輯卷等。
配置完畢單擊create cluster,節點開始進行安裝包和重啓
點開一個節點,能夠看到這個節點上全部相關服務都處於運行狀態。
登陸任意一個節點查看各服務的開機啓動狀況,爲2-5級別自動啓動。
[root@manager ~]# ssh openstack.node1"chkconfig --list | grep cman"
cman 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉
[root@manager ~]# ssh openstack.node1 "chkconfig --list | greprgmanager"
rgmanager 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉
[root@manager ~]# ssh openstack.node1 "chkconfig --list | grep clvmd"
clvmd 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉
[root@node1 ~]# cat /etc/cluster/cluster.conf \\查看各節點集羣配置信息,各節點這部分必須同樣。
[root@node1 ~]# clustat \\查看集羣節點狀態(能夠經過 cluster -i 1 動態查看變化狀態)