1. 程式人生 > 實用技巧 >GlusterFS分散式儲存系統複製集更換故障Brick操作記錄

GlusterFS分散式儲存系統複製集更換故障Brick操作記錄

GlusterFS 3節點的複製集,由於磁碟故障,其中一個複製集需要重灌系統,所以需要重灌glusterfs並將該節點加入glusterfs叢集

一. 安裝GlusterFS

首先在重灌系統節點安裝 glusterfs

  • Centos
yum -y install centos-release-gluster 
yum -y install glusterfs-server 
systemctl start glusterd.service
systemctl enable glusterd.service
systemctl status glusterd.service
  • Ubuntu
apt-get -y install glusterfs-server
systemctl start glusterfs-server
systemctl enable glusterfs-server
systemctl status glusterfs-server

確保與之前節點的GlusterFS版本一致,如果不一致,可將之前節點GlusterFS進行版本升級

  • Ubuntu系統GlusterFS升級
apt install -y software-properties-common
add-apt-repository ppa:gluster/glusterfs-7
apt-get update
killall glusterfs 
systemctl stop glustereventsd
apt-get -y install glusterfs-server

升級過程中可能會出現重啟失敗,ps -ef檢視有關glusterfs的程序,kill掉重啟即可

二. 加入GlusterFS叢集

  • 修改UUID

在正常節點獲取該節點UUID資訊,損壞節點為 gfs02

在/var/lib/glusterd/peers目錄下,新建glusterd.info,將原UUID和operating-version資訊寫入該檔案。

$ vi /var/lib/glusterd/glusterd.info
UUID=a7d9c9a8-e0bc-44da-8a86-6077f37038b0
operating-version=30706

重啟glusterd服務

 systemctl restart glusterd

若無法啟動,將 /var/lib/glusterd/ 下檔案除 glusterd.info 外全部刪除,kill相關程序進行重啟

  • 在正常節點檢視叢集節點狀態
$ gluster peer status
Number of Peers: 2

Hostname: gfs01
Uuid: f1061036-70cf-49b0-a482-4139b7e0eb7f
State: Peer in Cluster (Connected)

Hostname: gfs02
Uuid: a7d9c9a8-e0bc-44da-8a86-6077f37038b0
State: Accepted peer request (Connected)

出現這種狀態後排查原因得知是由於 /var/lib/glusterd/peers/a7d9c9a8-e0bc-44da-8a86-6077f37038b0 檔案中state值不一致導致,將除gfs02節點外其他節點此檔案值修改為與之前檔案中的一致,重啟服務

uuid=a7d9c9a8-e0bc-44da-8a86-6077f37038b0
state=3
hostname1=gfs02

再次檢視,恢復正常

root@paas22-3:~# gluster peer status
Number of Peers: 2

Hostname: gfs01
Uuid: f1061036-70cf-49b0-a482-4139b7e0eb7f
State: Peer in Cluster (Connected)

Hostname: gfs02
Uuid: a7d9c9a8-e0bc-44da-8a86-6077f37038b0
State: Peer in Cluster (Connected)

到此完成重新加入叢集