小編給大家分享一下GlusterFS如何安裝與配置,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都創(chuàng)新互聯(lián)公司,為您提供網(wǎng)站建設(shè)、成都網(wǎng)站制作、網(wǎng)站營銷推廣、網(wǎng)站開發(fā)設(shè)計,對服務(wù)服務(wù)器托管等多個行業(yè)擁有豐富的網(wǎng)站建設(shè)及推廣經(jīng)驗。成都創(chuàng)新互聯(lián)公司網(wǎng)站建設(shè)公司成立于2013年,提供專業(yè)網(wǎng)站制作報價服務(wù),我們深知市場的競爭激烈,認真對待每位客戶,為客戶提供賞心悅目的作品。 與客戶共同發(fā)展進步,是我們永遠的責(zé)任!
GlusterFS是一個開源的分布式文件系統(tǒng),于2011年被紅帽收購.它具有高擴展性、高性能、高可用性、可橫向擴展的彈性特點,無元數(shù)據(jù)服務(wù)器設(shè)計使glusterfs沒有單點故障隱患,詳細介紹請查看官網(wǎng):www.gluster.org 。
部署環(huán)境:
OS: CentOS release 6.5 (Final) x64
Server:
c1:192.168.242.132
c2:192.168.242.133
c3:192.168.242.134
c4:192.168.242.135
hosts:
192.168.242.132 c1
192.168.242.133 c2
192.168.242.134 c3
192.168.242.135 c4
具體操作:
c1/c2/c3/c4上執(zhí)行
[root@c1 ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
[root@c1 yum.repos.d]# yum install -y glusterfs glusterfs-server glusterfs-fuse
[root@c1 yum.repos.d]# /etc/init.d/glusterd start
Starting glusterd: [ OK ]
[root@c1 yum.repos.d]# chkconfig glusterd on
c1上配置集群
[root@c1 ~]# gluster peer probe c1
peer probe: success. Probe on localhost not needed
[root@c1 ~]# gluster peer probe c2
peer probe: success.
[root@c1 ~]# gluster peer probe c3
peer probe: success.
[root@c1 ~]# gluster peer probe c4
peer probe: success.
如果c1在peer表中被識別為ip地址,可能后面集群過程中會出現(xiàn)通訊問題,
我們可以使用ip來進行修復(fù):
[root@c3 ~]# gluster peer status
Number of Peers: 3
Hostname: 192.168.242.132
Uuid: 6e8d6880-ec36-4331-a806-2e8fb4fda7be
State: Peer in Cluster (Connected)
Hostname: c2
Uuid: 9a722f50-911e-4181-823d-572296640486
State: Peer in Cluster (Connected)
Hostname: c4
Uuid: 1ee3588a-8a16-47ff-ba59-c0285a2a95bd
State: Peer in Cluster (Connected)
[root@c3 ~]# gluster peer detach 192.168.242.132
peer detach: success
[root@c3 ~]# gluster peer probe c1
peer probe: success.
[root@c3 ~]# gluster peer status
Number of Peers: 3
Hostname: c2
Uuid: 9a722f50-911e-4181-823d-572296640486
State: Peer in Cluster (Connected)
Hostname: c4
Uuid: 1ee3588a-8a16-47ff-ba59-c0285a2a95bd
State: Peer in Cluster (Connected)
Hostname: c1
Uuid: 6e8d6880-ec36-4331-a806-2e8fb4fda7be
State: Peer in Cluster (Connected)
c1上創(chuàng)建集群磁盤
[root@c1 ~]# gluster volume create datavolume1 replica 2 transport tcp c1:/usr/local/share/datavolume1 c2:/usr/local/share/datavolume1 c3:/usr/local/share/datavolume1 c4:/usr/local/share/datavolume1 force
volume create: datavolume1: success: please start the volume to access data
[root@c1 ~]# gluster volume create datavolume2 replica 2 transport tcp c1:/usr/local/share/datavolume2 c2:/usr/local/share/datavolume2 c3:/usr/local/share/datavolume2 c4:/usr/local/share/datavolume2 force
volume create: datavolume2: success: please start the volume to access data
[root@c1 ~]# gluster volume create datavolume3 replica 2 transport tcp c1:/usr/local/share/datavolume3 c2:/usr/local/share/datavolume3 c3:/usr/local/share/datavolume3 c4:/usr/local/share/datavolume3 force
volume create: datavolume3: success: please start the volume to access data
[root@c1 ~]# gluster volume start datavolume1
volume start: datavolume1: success
[root@c1 ~]# gluster volume start datavolume2
volume start: datavolume2: success
[root@c1 ~]# gluster volume start datavolume3
volume start: datavolume3: success
[root@c1 ~]# gluster volume info
Volume Name: datavolume1
Type: Distributed-Replicate
Volume ID: 819d3dc4-2a3a-4342-b49b-3b7961ef624f
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: c1:/usr/local/share/datavolume1
Brick2: c2:/usr/local/share/datavolume1
Brick3: c3:/usr/local/share/datavolume1
Brick4: c4:/usr/local/share/datavolume1
Volume Name: datavolume2
Type: Distributed-Replicate
Volume ID: d9ebaee7-ef91-4467-9e44-217a63635bfc
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: c1:/usr/local/share/datavolume2
Brick2: c2:/usr/local/share/datavolume2
Brick3: c3:/usr/local/share/datavolume2
Brick4: c4:/usr/local/share/datavolume2
Volume Name: datavolume3
Type: Distributed-Replicate
Volume ID: 1e8b21db-f377-468b-b76e-868edde93f15
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: c1:/usr/local/share/datavolume3
Brick2: c2:/usr/local/share/datavolume3
Brick3: c3:/usr/local/share/datavolume3
Brick4: c4:/usr/local/share/datavolume3
客戶端環(huán)境部署
Centos OS 6.5 x64 并加入hosts
[root@c5 ~]#wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
[root@c5 ~]#yum install -y glusterfs glusterfs-fuse
[root@c5 ~]# mkdir -p /mnt/{datavolume1,datavolume2,datavolume3}
[root@c5 ~]# mount -t glusterfs -o ro c1:datavolume1 /mnt/datavolume1/
[root@c5 ~]# mount -t glusterfs -o ro c1:datavolume2 /mnt/datavolume2/
[root@c5 ~]# mount -t glusterfs -o ro c1:datavolume3 /mnt/datavolume3/
me3
[root@c5 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
38G 840M 36G 3% /
tmpfs 242M 0 242M 0% /dev/shm
/dev/sda1 485M 32M 429M 7% /boot
c1:datavolume1 57G 2.4G 52G 5% /mnt/datavolume1
c1:datavolume2 57G 2.4G 52G 5% /mnt/datavolume2
c1:datavolume3 57G 2.4G 52G 5% /mnt/datavolume3
客戶端測試
[root@c5 ~]# umount /mnt/datavolume1/
[root@c5 ~]# mount -t glusterfs c1:datavolume1 /mnt/datavolume1/
[root@c5 ~]# touch /mnt/datavolume1/test.txt
[root@c5 ~]# ls /mnt/datavolume1/test.txt
/mnt/datavolume1/test.txt
[root@c2 ~]# ls -al /usr/local/share/datavolume1/
total 16
drwxr-xr-x. 3 root root 4096 May 15 03:50 .
drwxr-xr-x. 8 root root 4096 May 15 02:28 ..
drw——-. 6 root root 4096 May 15 03:50 .glusterfs
-rw-r–r–. 2 root root 0 May 20 2014 test.txt
[root@c1 ~]# ls -al /usr/local/share/datavolume1/
total 16
drwxr-xr-x. 3 root root 4096 May 15 03:50 .
drwxr-xr-x. 8 root root 4096 May 15 02:28 ..
drw——-. 6 root root 4096 May 15 03:50 .glusterfs
-rw-r–r–. 2 root root 0 May 20 2014 test.txt
刪除GlusterFS磁盤:
gluster volume stop datavolume1
gluster volume delete datavolume1
卸載GlusterFS磁盤:
gluster peer detach idc1-server4
訪問控制:
gluster volume set datavolume1 auth.allow 192.168.242.*,192.168.241.*
添加GlusterFS節(jié)點:
gluster peer probe c6
gluster peer probe c7
gluster volume add-brick datavolume1 c6:/usr/local/share/datavolume1 c7:/usr/local/share/datavolume1
遷移GlusterFS磁盤數(shù)據(jù):
gluster volume remove-brick datavolume1 c1:/usr/local/share/datavolume1 c6:/usr/local/share/datavolume1 start
gluster volume remove-brick datavolume1 c1:/usr/local/share/datavolume1 c6:/usr/local/share/datavolume1 status
gluster volume remove-brick datavolume1 c1:/usr/local/share/datavolume1 c6:/usr/local/share/datavolume1 commit
數(shù)據(jù)重新分配:
gluster volume rebalance datavolume1 start
gluster volume rebalance datavolume1 status
gluster volume rebalance datavolume1 stop
修復(fù)GlusterFS磁盤數(shù)據(jù)(例如在c1宕機的情況下):
gluster volume replace-brick datavolume1 c1:/usr/local/share/datavolume1 c6:/usr/local/share/datavolume1 commit -force
gluster volume heal datavolume1 full
以上是“GlusterFS如何安裝與配置”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
標(biāo)題名稱:GlusterFS如何安裝與配置
標(biāo)題來源:http://www.rwnh.cn/article36/jscdpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站導(dǎo)航、服務(wù)器托管、建站公司、做網(wǎng)站、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)