Build Glusterfs on CakeHA

- - - 紀錄於機房三台server設定流程 - - -

Server HostName Role 對外(web) 對內(mgmt) centerha gluster
No. c1 Center 140.92.25. 192.168.10. 192.168.10. 192.168.10.
No. c2 Center 140.92.25. 192.168.10. 192.168.10. 192.168.10.
No. n1 Node 140.92.25. 192.168.10. 192.168.10. 192.168.10.
No. n2 Node 140.92.25. 192.168.10. 192.168.10. 192.168.10.

 

1. Install CAKE

installing

  • 兩台Center,兩台Node
  • Center安裝時,使用local disk(打勾)
  • Node安裝時,Center IP 設定成第一台Center 1

 
cakeweb

  • add kernel port
    • centerha
    • vswitch 1
  • edit centerha
    • type: static
    • IP (192.168.10.xx)
    • netmask (255.255.255.0)
  • 使用ifconfig確認是否成功

 

2. Install Gluster

touch /etc/yum.repos.d/Gluster.repo
[glusterfs-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key
 
[glusterfs-noarch-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/noarch
enabled=1
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key
 
[glusterfs-source-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes. - Source
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=1
gpgkey=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/pub.key
yum install gdisk glusterfs{,-server,-fuse,-geo-replication} -y
rm /etc/yum.repos.d/Gluster.repo
yum clean all

 

3. setting Gluster

ssh rickymax@140.92.25.149
cd centerHA-gluster
./set-gluster-dht-rep.sh
# for each server
./0_gluster.sh
 
# for c1
./1_gluster.sh
 
# for each server
./2_gluster.sh

 

4. Enable Center HA

檢查兩台Center時間

date
ntpdate -s time.stdtime.gov.tw (optional)

 
啟動CenterHA
cd /opt/DynaVirtual_3.0/bin/
./Enable_Center_HA.sh
1. slave center (The IP of mgmt)
2. slave center (root password)
3. master center (The IP of centerha)
4. slave center (The IP of centerha)
 
6. health check (period)
7. failure count (to trigger fail-over)
 
8. Do you want to ENABLE Center HA?  [N/y]

 

5. corosync 是否運作正常?

- 主機狀態顯示offline (於offline那台上執行)

cd /opt/DynaVirtual_3.0/cluster/tools/commands/
./kill_corosync.sh
 
./service_corosync_start.sh
./check_corosync.sh

 

6. 手動更換 master/slave

- 將master切換成standby,此時若是另一台slave為online
- 則master/slave 角色互換

# standby master
cd /opt/DynaVirtual_3.0/cluster/tools/commands
./crm_node_standby.sh
 
./crm_node_online

  

7. drbd 是否運作正常?

Check drbd current state

  • Connected => 正常
  • StandAlone => split-brain problem
  • WFConnection => slave wait for master
cd /opt/DynaVirtual_3.0/cluster/tools/commands
./check_drbd.sh

 
StandAlone (slave)
./drbdadm_discard-my-date.sh
# after that, slave is in WFConnection state

 
StandAlone (master) / WFConnection (slave)
./drbdadm_connect_centerha.sh

 

8. 完成

此時只會保留一台center
另外一台center當作備援,並且除了centerha之外無其他IP可使用
gluster在兩台center上依舊運作正常。
 
進入 CAKE web 完成最後設定

#High Availability Settings
[打勾] execute HA if host crash
除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License