您好,登錄后才能下訂單哦!
分布式文件系統Glusterfs
Gluster File System 是自由軟件,主要由 Z RESEARCH 公司負責開發,十幾名開發者,最近非常活躍。主要應用在集群系統中,具有很好的可擴展性。軟件的結構設計良好,易于擴展和配置,通過各個模塊的靈活搭配以得到針對性的解決方案。可解決以下問題:網絡存儲,聯合存儲(融合多個節點上的存儲空間),冗余備份,大文件的負載均衡(分塊)。
準備三臺機器:
[root@node1 data]# cat /etc/redhat-release
CentOS release 6.8 (Final)
Node1: | 192.168.70.71 | server |
Node2: | 192.168.70.72 | server |
Node3: | 192.168.70.73 | client |
vi /etc/sysconfig/iptables:
-A INPUT -m state--state NEW -m tcp -p tcp --dport 24007:24008 -j ACCEPT
-A INPUT -m state --stateNEW -m tcp -p tcp --dport 49152:49162 -j ACCEPT
service iptables restart
Server1和server2下都執行以下操作:
安裝方法1:
·
wget -l 1 -nd -nc -r -A.rpmhttp://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/CentOS/epel-6Server/x86_64/
wget -l 1 -nd -nc -r -A.rpmhttp://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/CentOS/epel-6Server/noarch/
wget -nc
http://download.gluster.org/pub/gluster/nfs-ganesha/2.3.0/EPEL.repo/epel-6Server/x86_64/nfs-ganesha-gluster-2.3.0-1.el6.x86_64.rpm
yum install * -y
方法二:(不同版本)
mkdir tools
cd /tools
wget -l 1 -nd -nc -r -A.rpm http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.5/RHEL/epel-6/x86_64/
yum install *.rpm
開啟gluster服務
/etc/init.d/glusterd start
設置glusterFS服務開機啟動
chkconfig glusterd on
[root@node1 /]# gluster peer probe 192.168.70.72
peer probe: success.
[root@node1 /]# gluster peer status
Number of Peers: 1
Hostname: 192.168.70.72
Uuid: fdc6c52d-8393-458a-bf02-c1ff60a0ac1b
State: Accepted peer request (Connected)
[root@node1 /]# gluster peer detach 192.168.70.72
peer detach: success
[root@node1 /]# gluster peer status
Number of Peers: 0
在node1和node2分別建立mkdir /data/gfs/
mkdir /data/gfs/
創建邏輯卷、
gluster volume create vg0 replica 2192.168.70.71:/data/gfs 192.168.70.72:/data/gfs force
volume create: vg0: success: please startthe volume to access data
查看邏輯卷信息
[root@node1 /]# gluster volume info
Volume Name: vg0
Type: Replicate
Volume ID: 6aff1f4f-8efe-4ed0-879e-95df483a86a2
Status: Created
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 192.168.70.71:/data/gfs
Brick2: 192.168.70.72:/data/gfs
[root@node1 /]# gluster volume status
Volume vg0 is not started
開啟邏輯卷
[root@node1 /]# gluster volume start vg0
volume start: vg0: success
yum -y install glusterfs glusterfs-fuse
mount -t glusterfs 192.168.70.71:/gv0/mnt/gfs
# 卷擴容(由于副本數設置為2,至少要添加2(4、6、8..)臺機器)
gluster peer probe 192.168.70.74 # 加節點
gluster peer probe 192.168.70.75 # 加節點
gluster volume add-brick gv0 192.168.70.74:/data/glusterfs192.168.70.75:/data/glusterfs # 合并卷
收縮卷(收縮卷前gluster需要先移動數據到其他位置)
gluster volume remove-brick gv0 192.168.70.74:/data/glusterfs 192.168.70.75:/data/glusterfsstart # 開始遷移
gluster volume remove-brick gv0 192.168.70.74:/data/glusterfs192.168.70.74:/data/glusterfsstatus # 查看遷移狀態
gluster volume remove-brick gv0 192.168.70.74:/data/glusterfs192.168.70.74:/data/glusterfs commit # 遷移完成后提交
# 遷移卷
gluster peer probe 192.168.70.75# 將192.168.70.76數據遷移到192.168.70.75先將192.168.70.75加入集群
gluster volume replace-brick gv0 192.168.70.76:/data/glusterfs192.168.70.75:/data/glusterfsstart # 開始遷移
gluster volume replace-brick gv0 192.168.70.76:/data/glusterfs192.168.70.75:/data/glusterfsstatus # 查看遷移狀態
gluster volume replace-brick gv0 192.168.70.76:/data/glusterfs192.168.70.75:/data/glusterfscommit # 數據遷移完畢后提交
gluster volume replace-brick gv0 192.168.70.76:/data/glusterfs192.168.70.75:/data/glusterfs commit -force # 如果機器192.168.70.76出現故障已經不能運行,執行強制提交
gluster volume heal gv0full # 同步整個卷
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。