GFS基礎(chǔ)配置安裝-創(chuàng)新互聯(lián)

GFS基礎(chǔ)配置安裝

基本概述

? GFS是一個(gè)可擴(kuò)展的分布式文件系統(tǒng),用于大型的、分布式的、對(duì)大量數(shù)據(jù)進(jìn)行訪問(wèn)的應(yīng)用。它運(yùn)行于廉價(jià)的普通硬件上,并提供容錯(cuò)功能。它可以給大量的用戶提供總體性能較高的服務(wù)。

成都創(chuàng)新互聯(lián)公司專注于內(nèi)蒙古網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供內(nèi)蒙古營(yíng)銷型網(wǎng)站建設(shè),內(nèi)蒙古網(wǎng)站制作、內(nèi)蒙古網(wǎng)頁(yè)設(shè)計(jì)、內(nèi)蒙古網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)公司服務(wù),打造內(nèi)蒙古網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供內(nèi)蒙古網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。

基本部署步驟

一、實(shí)驗(yàn)準(zhǔn)備

名稱 角色 IP地址
centos7-1node1192.168.142.66
centos7-2node2192.168.142.77
centos7-3node3192.168.142.132
centos7-4node4192.168.142.136
centos7-minclient192.168.142.172

二、開始安裝

(1)為滿足實(shí)驗(yàn)?zāi)康脑鎏碛脖P

centos7-1

/dev/sdb1                 20G   33M   20G    1% /mnt/sdb1
/dev/sdc1                 20G   33M   20G    1% /mnt/sdc1
/dev/sdd1                 20G   33M   20G    1% /mnt/sdd1
/dev/sde1                 20G   33M   20G    1% /mnt/sde1

centos7-2

/dev/sdb1                 20G   33M   20G    1% /mnt/sdb1
/dev/sdc1                 20G   33M   20G    1% /mnt/sdc1
/dev/sdd1                 20G   33M   20G    1% /mnt/sdd1
/dev/sde1                 20G   33M   20G    1% /mnt/sde1

centos7-3

/dev/sdb1                 20G   33M   20G    1% /mnt/sdb1
/dev/sdc1                 20G   33M   20G    1% /mnt/sdc1
/dev/sdd1                 20G   33M   20G    1% /mnt/sdd1
/dev/sde1                 20G   33M   20G    1% /mnt/sde1

centos7-4

/dev/sdb1                 20G   33M   20G    1% /mnt/sdb1
/dev/sdc1                 20G   33M   20G    1% /mnt/sdc1
/dev/sdd1                 20G   33M   20G    1% /mnt/sdd1
/dev/sde1                 20G   33M   20G    1% /mnt/sde1
(2)安裝GFS(所有存儲(chǔ)節(jié)點(diǎn)均需要安裝)

修改本地hosts文件,方便識(shí)別

[root@node1 yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4

配置本地YUM源

(原自帶YUM倉(cāng)庫(kù)無(wú)法滿足需求)

[root@node1 mnt]# cd /etc/yum.repos.d/
[root@node1 yum.repos.d]# mkdir bak
[root@node1 yum.repos.d]# mv CentOS-* bak/
[root@node3 zhy]# cp -r gfsrepo/ /mnt/
[root@node3 yum.repos.d]# vim GFSrep.repo
//手動(dòng)添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1

安裝gfs組件并開啟

[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma

//開啟服務(wù)
[root@node1 yum.repos.d]# systemctl start glusterd
[root@node1 yum.repos.d]# systemctl enable glusterd
[root@node1 yum.repos.d]# systemctl stop firewalld.service
[root@node1 yum.repos.d]# setenforce 0

與阿里時(shí)間服務(wù)器進(jìn)行同步

[root@node1 yum.repos.d]# ntpdate ntp1.aliyun.com
18 Dec 19:55:56 ntpdate[2843]: adjust time server 120.25.115.20 offset 0.010820 sec

添加儲(chǔ)存信任池(只需要在任一存儲(chǔ)節(jié)點(diǎn)添加即可)

[root@node1 yum.repos.d]# gluster peer probe node2
peer probe: success.
[root@node1 yum.repos.d]# gluster peer probe node3
peer probe: success.
[root@node1 yum.repos.d]# gluster peer probe node4
peer probe: success.
[root@node1 yum.repos.d]# gluster peer status          //查看各節(jié)點(diǎn)狀態(tài)

二、建立分布式卷

特點(diǎn): (通過(guò)HASH算法進(jìn)行分布)

沒(méi)有冗余性

單點(diǎn)故障,數(shù)據(jù)會(huì)丟失

[root@node1 yum.repos.d]# gluster volume create fenbu node1:/mnt/sdb1 node2:/mnt/sdb1 force
//使用node1的sdb1和node2的sdb1作為節(jié)點(diǎn),部署分布式卷,“force”強(qiáng)制執(zhí)行
volume create: fenbu: success: please start the volume to access data

 //查看分布式卷信息
[root@node1 yum.repos.d]# gluster volume info fenbu

Volume Name: fenbu
Type: Distribute
Volume ID: e7833052-a4c7-4c9f-9660-dc60db737543
。。。。。。
Bricks:
Brick1: node1:/mnt/sdb1
Brick2: node2:/mnt/sdb1

//查看卷組列表
[root@node1 yum.repos.d]# gluster volume list

//開啟分布式卷
[root@node1 yum.repos.d]# gluster volume start fenbu
volume start: fenbu: success

三、建立條帶卷

特點(diǎn):

根據(jù)偏移量將文件分成N塊(N個(gè)條器節(jié)點(diǎn)),輪詢的存儲(chǔ)在每個(gè)Brick Server節(jié)點(diǎn)

存儲(chǔ)大文件時(shí),性能尤為突出

不具備冗余性,類似Raid0

[root@node1 mnt]# gluster volume create tiaodai stripe 2 node1:/mnt/sdc1 node2:/mnt/sdc1 force
//“stripe”  分為兩個(gè)區(qū)

//開啟條帶卷
[root@node1 mnt]# gluster volume start tiaodai
volume start: tiaodai: success

//查看條帶卷信息
[root@node1 yum.repos.d]# gluster volume info fenbu
Volume Name: tiaodai
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdc1
Brick2: node2:/mnt/sdc1
Options Reconfigured:

四、建立復(fù)制卷

特點(diǎn):

同一份文件保存一份或者多分副本

讀寫速度較慢

具備冗余性

必須由兩個(gè)或更多數(shù)據(jù)庫(kù)組成

[root@node1 mnt]# gluster volume create fuzhi replica 2 node3:/mnt/sdb1 node4:/mnt/sdb1 force
//“replica”    建立副本數(shù)

[root@node1 mnt]# gluster volume start fuzhi
volume start: fuzhi: success

[root@node1 mnt]# gluster volume info fuzhi

Volume Name: fuzhi
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node3:/mnt/sdb1
Brick2: node4:/mnt/sdb1

五、建立分布式條帶卷

特點(diǎn):

兼顧分布式卷和條帶卷的功能

用于大文件處理

至少需要四臺(tái)服務(wù)器

[root@node1 mnt]# gluster volume create fenbu-tiao stripe 2 node1:/mnt/sdd1 node2:/mnt/sdd1 node3:/mnt/sdd1 node4:/mnt/sdd1 force
//“stripe”   具備條帶卷功能,因此需要分片

[root@node1 mnt]# gluster volume start fenbu-tiao
volume start: fenbu-tiao: success

[root@node1 mnt]# gluster volume info fenbu-tiao

Volume Name: fenbu-tiao
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdd1
Brick2: node2:/mnt/sdd1
Brick3: node3:/mnt/sdd1
Brick4: node4:/mnt/sdd1

六、建立分布式復(fù)制卷

特點(diǎn):

兼顧分布式和復(fù)制卷的功能

具有冗余功能

[root@node1 mnt]# gluster volume create fenbu-copy replica 2 node1:/mnt/sde1 node2:/mnt/sde1 node3:/mnt/sde1 node4:/mnt/sde1 force

[root@node1 mnt]# gluster volume start fenbu-copy
volume start: fenbu-copy: success

[root@node1 mnt]# gluster volume info fenbu-copy

Volume Name: fenbu-copy
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sde1
Brick2: node2:/mnt/sde1
Brick3: node3:/mnt/sde1
Brick4: node4:/mnt/sde1

七、客戶端配置

修改本地Hosts文件

[root@node1 yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4

配置本地YUM源

[root@node1 mnt]# cd /etc/yum.repos.d/
[root@node1 yum.repos.d]# mkdir bak
[root@node1 yum.repos.d]# mv CentOS-* bak/
[root@node3 zhy]# cp -r gfsrepo/ /mnt/
[root@node3 yum.repos.d]# vim GFSrep.repo
//手動(dòng)添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1

安裝gfs組件

[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-fuse

GFS新建的卷進(jìn)行掛載

[root@client yum.repos.d]# mkdir -p /data/fenbu              //新建分布式卷掛載點(diǎn)
[root@client yum.repos.d]# mkdir -p /data/tiaodai             //新建條帶卷掛載點(diǎn)
[root@client yum.repos.d]# mkdir -p /data/fuzhi               //新建復(fù)制卷掛載點(diǎn)
[root@client yum.repos.d]# mkdir -p /data/fenbu-tiao       //新建分布式條帶卷掛載點(diǎn)
[root@client yum.repos.d]# mkdir -p /data/fenbu-copy     //新建分布式復(fù)制卷

[root@client yum.repos.d]# mount.glusterfs node1:fenbu /data/fenbu/             //將分布卷進(jìn)行掛載
[root@client yum.repos.d]# df -hT
文件系統(tǒng)                類型            容量  已用  可用 已用% 掛載點(diǎn)
node1:fenbu             fuse.glusterfs   40G   65M   40G    1% /data/fenbu

[root@client yum.repos.d]# mount.glusterfs node1:tiaodai /data/tiaodai/         //掛載條帶卷
[root@client yum.repos.d]# df -hT
文件系統(tǒng)                類型            容量  已用  可用 已用% 掛載點(diǎn)
node1:tiaodai           fuse.glusterfs   40G   65M   40G    1% /data/tiaodai

[root@client yum.repos.d]# mount.glusterfs node3:fuzhi /data/fuzhi             //掛載復(fù)制卷
[root@client yum.repos.d]# df -hT
文件系統(tǒng)                類型            容量  已用  可用 已用% 掛載點(diǎn)
node3:fuzhi             fuse.glusterfs   20G   33M   20G    1% /data/fuzhi

[root@client yum.repos.d]# mount.glusterfs node1:fenbu-tiao /data/fenbu-tiao/         //掛載分布式條帶卷
[root@client yum.repos.d]# df -hT
文件系統(tǒng)                類型            容量  已用  可用 已用% 掛載點(diǎn)
node1:fenbu-tiao        fuse.glusterfs   80G  130M   80G    1% /data/fenbu-tiao

[root@client yum.repos.d]# mount.glusterfs node4:fenbu-copy /data/fenbu-copy/       //掛載分布式復(fù)制卷
[root@client yum.repos.d]# df -hT
文件系統(tǒng)                類型            容量  已用  可用 已用% 掛載點(diǎn)
node4:fenbu-copy        fuse.glusterfs   40G   65M   40G    1% /data/fenbu-copy

八、對(duì)各類卷進(jìn)行測(cè)試

建立六個(gè)測(cè)試文件

[root@client data]# dd if=/dev/zero of=test1.log bs=10M count=10

[root@client data]# dd if=/dev/zero of=test2.log bs=10M count=10

[root@client data]# dd if=/dev/zero of=test3.log bs=10M count=10

[root@client data]# dd if=/dev/zero of=test4.log bs=10M count=10

[root@client data]# dd if=/dev/zero of=test5.log bs=10M count=10

[root@client data]# dd if=/dev/zero of=test6.log bs=10M count=10

將文件復(fù)制進(jìn)各個(gè)卷中

[root@client data]# cp test* fenbu
[root@client data]# cp test* fenbu-copy/
[root@client data]# cp test* fenbu-tiao/
[root@client data]# cp test* fuzhi/
[root@client data]# cp test* tiaodai/

查看分布式卷(node1:sdb1、node2:sdb1)

//node1
[root@node1 mnt]# ll -h sdb1/
總用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:55 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log
//node2
[root@node2 mnt]# ll -h sdb1/
總用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log

查看條帶卷(node1:sdc1、node2:sdc1)

//將每個(gè)數(shù)據(jù)都分成兩塊存儲(chǔ)(分成幾份由建立時(shí)的stripe決定)
//node1
[root@node1 mnt]# ll -h sdc1/
總用量 300M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
//node2
[root@node2 mnt]# ll -h sdc1/
總用量 300M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log

查看復(fù)制卷(node3:sdb1、node4:sdb1)

//所有數(shù)據(jù)均復(fù)制一份存儲(chǔ)
//node3
[root@node3 mnt]# ll -h sdb1/
總用量 600M
-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log
//node4
[root@node4 mnt]# ll -h sdb1/
總用量 600M
-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log

查看分布式條帶卷(node1:sdd1、node2:sdd1、node3:sdd1、node4:sdd1)

//node1 & node2
[root@node1 mnt]# ll -h sdd1/
總用量 200M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
[root@node2 mnt]# ll -h sdd1/
總用量 200M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log

//node3 & node4
[root@node3 mnt]# ll -h sdd1/
總用量 100M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
[root@node4 mnt]# ll -h sdd1/
總用量 100M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log

查看分布式復(fù)制卷(node1~4:sde1)

//node1 & node2
[root@node1 mnt]# ll -h sde1/
總用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log
[root@node2 mnt]# ll -h sde1/
總用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log

//node3 & node4
[root@node3 mnt]# ll -h sde1/
總用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log
[root@node4 mnt]# ll -h sde1/
總用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

新聞名稱:GFS基礎(chǔ)配置安裝-創(chuàng)新互聯(lián)
分享鏈接:http://bm7419.com/article2/dsceic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)標(biāo)簽優(yōu)化、外貿(mào)網(wǎng)站建設(shè)、品牌網(wǎng)站建設(shè)微信小程序、小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開發(fā)