目前測試環(huán)境的OpenStack存儲后端部分采用的GlusterFS略步,記下日常使用的一些命令方便其他同事查看罐寨。
運(yùn)維命令####
創(chuàng)建卷
$ gluster volume create cinder-volumes replica 2 transport tcp host1:/brick/volume1 host2:/brick/volume1 host3:/brick/volume1 host4:/brick/volume1
卷設(shè)置
$ gluster volume cinder-volumes set nfs.disable on
$ gluster volume cinder-volumes set performance.readdir-ahead on
$ gluster volume cinder-volumes set transport.address-family inet
$ gluster volume cinder-volumes set performance.read-ahead-page-count 8
$ gluster volume cinder-volumes set performance.io-thread-count 16
$ gluster volume cinder-volumes set network.ping-timeout 10
$ gluster volume cinder-volumes set performance.cache-size 8GB
$ gluster volume cinder-volumes set cluster.self-heal-daemon on
$ gluster volume cinder-volumes set cluster.heal-timeout 300
$ gluster volume cinder-volumes set performance.write-behind-window-size 256MB
$ gluster volume cinder-volumes set performance.io-cache off
$ gluster volume cinder-volumes set server.allow-insecure on
擴(kuò)容卷
$ gluster volume add-brick cinder-volumes replica 2 host1:/brick/volume1 host2:/brick/volume1
#重建數(shù)據(jù)
$ gluster volume rebalance cinder-volumes start [force]
$ gluster volume rebalance cinder-volumes status
縮容卷
若是副本卷,則移除的Bricks數(shù)是replica的整數(shù)倍;stripe具有同樣的要求.
$ gluster volume remove-brick cinder-volumes host1:/brick/volume1 host2:/brick/volume1
#執(zhí)行start則開始遷移數(shù)據(jù)唇辨,系統(tǒng)會有負(fù)載
$ gluster volume remove-brick cinder-volumes start
$ gluster volume remove-brick cinder-volumes status
#不遷移數(shù)據(jù),直接刪除
$ gluster volume remove-brick cinder-volumes commit
替換卷
用host2的卷替換host1
$ gluster volume replace-brick cinder-volumes host1:/brick/volume1 host2:/brick/volume1 [force]
故障處理####
1.物理機(jī)數(shù)據(jù)盤硬盤故障
在正常的服務(wù)器上gluster的貢獻(xiàn)盤文件系統(tǒng)屬性能耻,然后設(shè)置到新硬盤掛載貢獻(xiàn)路徑上赏枚;
#獲取數(shù)據(jù)
$ getfattr -d -m '.*' /brick/volume1
getfattr: Removing leading '/' from absolute path names
# file: brick/volume1
trusted.gfid=0sAAAAAAAAAAAAAAAAAAAAAQ==
trusted.glusterfs.dht=0sAAAAAQAAAAA/////f////Q==
trusted.glusterfs.dht.commithash="3307144809"
trusted.glusterfs.volume-id=0sqcz7hnqRQ9asrnzx2DtUxQ==
#設(shè)置屬性
$ setfattr -n trusted.gfid -v 0sAAAAAAAAAAAAAAAAAAAAAQ== /brick/volume2
$ setfattr -n trusted.glusterfs.dht -v 0sAAAAAQAAAAA/////f////Q== /brick/volume2
$ setfattr -n trusted.glusterfs.dht.commithash -v "3168624641" /brick/volume2
$ setfattr -n trusted.glusterfs.volume-id -v 0sqcz7hnqRQ9asrnzx2DtUxQ== /brick/volume2
重啟glusterd服務(wù),然后查看健康狀態(tài)晓猛;
$ gluster volume heal cinder-volumes info
Brick host1:/brick/volume1
Status: Connected
Number of entries: 0
Brick host2:/brick/volume1
/data
Status: Connected
Number of entries: 1 # 顯示一個條目在修復(fù)饿幅,自動修復(fù)完成后會為 0