人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

CentOS7安裝GlusterFS集群的全過(guò)程

發(fā)布日期:2022-07-15 19:25 | 文章來(lái)源:源碼中國(guó)

CentOS 7 GlusterFS

環(huán)境說(shuō)明:

3臺(tái)機(jī)器安裝 GlusterFS 組成一個(gè)集群。

使用 docker volume plugin GlusterFS

服務(wù)器:

10.6.0.140
10.6.0.192
10.6.0.196

配置 hosts

10.6.0.140 swarm-manager
10.6.0.192 swarm-node-1
10.6.0.196 swarm-node-2

client:

10.6.0.94 node-94

安裝:

CentOS 安裝 glusterfs 非常的簡(jiǎn)單

在三個(gè)節(jié)點(diǎn)都安裝glusterfs

yum install centos-release-gluster
yum install -y glusterfs glusterfs-server glusterfs-fuseglusterfs-rdma

配置 GlusterFS 集群:

啟動(dòng) glusterFS

systemctl start glusterd.service
systemctl enable glusterd.service

在 swarm-manager 節(jié)點(diǎn)上配置,將 節(jié)點(diǎn) 加入到 集群中。

[root@swarm-manager ~]#gluster peer probe swarm-manager
peer probe: success. Probe on localhost not needed
[root@swarm-manager ~]#gluster peer probe swarm-node-1
peer probe: success.
[root@swarm-manager ~]#gluster peer probe swarm-node-2
peer probe: success.

查看集群狀態(tài):

[root@swarm-manager ~]#gluster peer status
Number of Peers: 2
Hostname: swarm-node-1
Uuid: 41573e8b-eb00-4802-84f0-f923a2c7be79
State: Peer in Cluster (Connected)
Hostname: swarm-node-2
Uuid: da068e0b-eada-4a50-94ff-623f630986d7
State: Peer in Cluster (Connected)

創(chuàng)建數(shù)據(jù)存儲(chǔ)目錄:

[root@swarm-manager ~]#mkdir -p /opt/gluster/data
[root@swarm-node-1 ~]# mkdir -p /opt/gluster/data
[root@swarm-node-2 ~]# mkdir -p /opt/gluster/data

查看volume 狀態(tài):

[root@swarm-manager ~]#gluster volume info
No volumes present

創(chuàng)建GlusterFS磁盤(pán):

[root@swarm-manager ~]#gluster volume create models replica 3 swarm-manager:/opt/gluster/data swarm-node-1:/opt/gluster/data swarm-node-2:/opt/gluster/data force
volume create: models: success: please start the volume to access data

GlusterFS 幾種volume 模式說(shuō)明:

一、 默認(rèn)模式,既DHT, 也叫 分布卷: 將文件已hash算法隨機(jī)分布到 一臺(tái)服務(wù)器節(jié)點(diǎn)中存儲(chǔ)。

gluster volume create test-volume server1:/exp1 server2:/exp2

二、 復(fù)制模式,既AFR, 創(chuàng)建volume 時(shí)帶 replica x 數(shù)量: 將文件復(fù)制到 replica x 個(gè)節(jié)點(diǎn)中。

gluster volume create test-volume replica 2 transport tcp server1:/exp1 server2:/exp2

三、 條帶模式,既Striped, 創(chuàng)建volume 時(shí)帶 stripe x 數(shù)量: 將文件切割成數(shù)據(jù)塊,分別存儲(chǔ)到 stripe x 個(gè)節(jié)點(diǎn)中 ( 類(lèi)似raid 0 )。

gluster volume create test-volume stripe 2 transport tcp server1:/exp1 server2:/exp2

四、 分布式條帶模式(組合型),最少需要4臺(tái)服務(wù)器才能創(chuàng)建。 創(chuàng)建volume 時(shí) stripe 2 server = 4 個(gè)節(jié)點(diǎn): 是DHT 與 Striped 的組合型。

gluster volume create test-volume stripe 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4

五、 分布式復(fù)制模式(組合型), 最少需要4臺(tái)服務(wù)器才能創(chuàng)建。 創(chuàng)建volume 時(shí) replica 2 server = 4 個(gè)節(jié)點(diǎn):是DHT 與 AFR 的組合型。

gluster volume create test-volume replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4

六、 條帶復(fù)制卷模式(組合型), 最少需要4臺(tái)服務(wù)器才能創(chuàng)建。 創(chuàng)建volume 時(shí) stripe 2 replica 2 server = 4 個(gè)節(jié)點(diǎn): 是 Striped 與 AFR 的組合型。

gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4

七、 三種模式混合, 至少需要8臺(tái) 服務(wù)器才能創(chuàng)建。 stripe 2 replica 2 , 每4個(gè)節(jié)點(diǎn) 組成一個(gè) 組。

gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4 server5:/exp5 server6:/exp6 server7:/exp7 server8:/exp8

再查看 volume 狀態(tài):

[root@swarm-manager ~]#gluster volume info
Volume Name: models
Type: Replicate
Volume ID: e539ff3b-2278-4f3f-a594-1f101eabbf1e
Status: Created
Number of Bricks: 1 x 3 = 3
Transport-type: tcp
Bricks:
Brick1: swarm-manager:/opt/gluster/data
Brick2: swarm-node-1:/opt/gluster/data
Brick3: swarm-node-2:/opt/gluster/data
Options Reconfigured:
performance.readdir-ahead: on

啟動(dòng) models

[root@swarm-manager ~]#gluster volume start models
volume start: models: success

gluster 性能調(diào)優(yōu):

開(kāi)啟 指定 volume 的配額: (models 為 volume 名稱(chēng))

gluster volume quota models enable

限制 models 中 / (既總目錄) 最大使用 80GB 空間

gluster volume quota models limit-usage / 80GB
#設(shè)置 cache 4GB
gluster volume set models performance.cache-size 4GB
#開(kāi)啟 異步 , 后臺(tái)操作
gluster volume set models performance.flush-behind on
#設(shè)置 io 線程 32
gluster volume set models performance.io-thread-count 32
#設(shè)置 回寫(xiě) (寫(xiě)數(shù)據(jù)時(shí)間,先寫(xiě)入緩存內(nèi),再寫(xiě)入硬盤(pán))
gluster volume set models performance.write-behind on

部署GlusterFS客戶(hù)端并mount GlusterFS文件系統(tǒng) (客戶(hù)端必須加入 glusterfs hosts 否則報(bào)錯(cuò)。)

[root@node-94 ~]#yum install -y glusterfs glusterfs-fuse
[root@node-94 ~]#mkdir -p /opt/gfsmnt
[root@node-94 ~]#mount -t glusterfs swarm-manager:models /opt/gfsmnt/
[root@node-94 ~]#df -h
文件系統(tǒng) 容量 已用 可用 已用% 掛載點(diǎn)
/dev/mapper/vg001-root 98G 1.2G 97G 2% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 130M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/vg001-opt 441G 71G 370G 17% /opt
/dev/sda2 497M 153M 344M 31% /boot
tmpfs 6.3G 0 6.3G 0% /run/user/0
swarm-manager:models 441G 18G 424G 4% /opt/gfsmnt

測(cè)試:

DHT 模式 客戶(hù)端 創(chuàng)建一個(gè) 1G 的文件

[root@node-94 ~]#time dd if=/dev/zero of=hello bs=1000M count=1
記錄了1+0 的讀入
記錄了1+0 的寫(xiě)出
1048576000字節(jié)(1.0 GB)已復(fù)制,9.1093 秒,115 MB/秒
real 0m9.120s
user 0m0.000s
sys 0m1.134s

AFR 模式 客戶(hù)端 創(chuàng)建一個(gè) 1G 的文件

[root@node-94 ~]#time dd if=/dev/zero of=hello.txt bs=1024M count=1
錄了1+0 的讀入
記錄了1+0 的寫(xiě)出
1073741824字節(jié)(1.1 GB)已復(fù)制,27.4566 秒,39.1 MB/秒
real 0m27.469s
user 0m0.000s
sys 0m1.065s

Striped 模式 客戶(hù)端 創(chuàng)建一個(gè) 1G 的文件

[root@node-94 ~]#time dd if=/dev/zero of=hello bs=1000M count=1
記錄了1+0 的讀入
記錄了1+0 的寫(xiě)出
1048576000字節(jié)(1.0 GB)已復(fù)制,9.10669 秒,115 MB/秒
real 0m9.119s
user 0m0.001s
sys 0m0.953s

條帶復(fù)制卷模式 (Number of Bricks: 1 x 2 x 2 = 4) 客戶(hù)端 創(chuàng)建一個(gè) 1G 的文件

[root@node-94 ~]#time dd if=/dev/zero of=hello bs=1000M count=1
記錄了1+0 的讀入
記錄了1+0 的寫(xiě)出
1048576000字節(jié)(1.0 GB)已復(fù)制,17.965 秒,58.4 MB/秒
real 0m17.978s
user 0m0.000s
sys 0m0.970s

分布式復(fù)制模式 (Number of Bricks: 2 x 2 = 4) 客戶(hù)端 創(chuàng)建一個(gè) 1G 的文件

[root@node-94 ~]#time dd if=/dev/zero of=haha bs=100M count=10
記錄了10+0 的讀入
記錄了10+0 的寫(xiě)出
1048576000字節(jié)(1.0 GB)已復(fù)制,17.7697 秒,59.0 MB/秒
real 0m17.778s
user 0m0.001s
sys 0m0.886s

針對(duì) 分布式復(fù)制模式還做了如下測(cè)試:

4K隨機(jī)寫(xiě) 測(cè)試:

安裝 fio (yum -y install libaio-devel (否則運(yùn)行fio 會(huì)報(bào)錯(cuò)engine libaio not loadable, 已安裝需重新編譯,否則一樣報(bào)錯(cuò)))

[root@node-94 ~]#fio -ioengine=libaio -bs=4k -direct=1 -thread -rw=randwrite -size=10G -filename=1.txt -name="EBS 4KB randwrite test" -iodepth=32 -runtime=60
write: io=352204KB, bw=5869.9KB/s, iops=1467, runt= 60002msec
WRITE: io=352204KB, aggrb=5869KB/s, minb=5869KB/s, maxb=5869KB/s, mint=60002msec, maxt=60002msec

4K隨機(jī)讀 測(cè)試:

fio -ioengine=libaio -bs=4k -direct=1 -thread -rw=randread -size=10G -filename=1.txt -name="EBS 4KB randread test" -iodepth=8 -runtime=60
read: io=881524KB, bw=14692KB/s, iops=3672, runt= 60001msec
READ: io=881524KB, aggrb=14691KB/s, minb=14691KB/s, maxb=14691KB/s, mint=60001msec, maxt=60001msec

512K 順序?qū)?測(cè)試:

fio -ioengine=libaio -bs=512k -direct=1 -thread -rw=write -size=10G -filename=512.txt -name="EBS 512KB seqwrite test" -iodepth=64 -runtime=60
write: io=3544.0MB, bw=60348KB/s, iops=117, runt= 60135msec
WRITE: io=3544.0MB, aggrb=60348KB/s, minb=60348KB/s, maxb=60348KB/s, mint=60135msec, maxt=60135msec

其他的維護(hù)命令:

1. 查看GlusterFS中所有的volume:

[root@swarm-manager ~]#gluster volume list

2. 刪除GlusterFS磁盤(pán):

[root@swarm-manager ~]#gluster volume stop models #停止名字為 models 的磁盤(pán)
[root@swarm-manager ~]#gluster volume delete models #刪除名字為 models 的磁盤(pán)

注: 刪除 磁盤(pán) 以后,必須刪除 磁盤(pán)( /opt/gluster/data ) 中的 ( .glusterfs/ .trashcan/ )目錄。

否則創(chuàng)建新 volume 相同的 磁盤(pán) 會(huì)出現(xiàn)文件 不分布,或者 類(lèi)型 錯(cuò)亂 的問(wèn)題。

3. 卸載某個(gè)節(jié)點(diǎn)GlusterFS磁盤(pán)

[root@swarm-manager ~]#gluster peer detach swarm-node-2

4. 設(shè)置訪問(wèn)限制,按照每個(gè)volume 來(lái)限制

[root@swarm-manager ~]#gluster volume set models auth.allow 10.6.0.*,10.7.0.*

5. 添加GlusterFS節(jié)點(diǎn):

[root@swarm-manager ~]#gluster peer probe swarm-node-3
[root@swarm-manager ~]#gluster volume add-brick models swarm-node-3:/opt/gluster/data

注:如果是復(fù)制卷或者條帶卷,則每次添加的Brick數(shù)必須是replica或者stripe的整數(shù)倍

6. 配置卷

[root@swarm-manager ~]# gluster volume set

7. 縮容volume:

先將數(shù)據(jù)遷移到其它可用的Brick,遷移結(jié)束后才將該Brick移除:

[root@swarm-manager ~]#gluster volume remove-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data start

在執(zhí)行了start之后,可以使用status命令查看移除進(jìn)度:

[root@swarm-manager ~]#gluster volume remove-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data status

不進(jìn)行數(shù)據(jù)遷移,直接刪除該Brick:

[root@swarm-manager ~]#gluster volume remove-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data commit

注意,如果是復(fù)制卷或者條帶卷,則每次移除的Brick數(shù)必須是replica或者stripe的整數(shù)倍。

擴(kuò)容:

gluster volume add-brick models swarm-node-2:/opt/gluster/data

8. 修復(fù)命令:

[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data commit -force

9. 遷移volume:

[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data start
pause 為暫停遷移
[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data pause
abort 為終止遷移
[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data abort
status 查看遷移狀態(tài)
[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data status
遷移結(jié)束后使用commit 來(lái)生效
[root@swarm-manager ~]#gluster volume replace-brick models swarm-node-2:/opt/gluster/data swarm-node-3:/opt/gluster/data commit

10. 均衡volume:

[root@swarm-manager ~]#gluster volume models lay-outstart
[root@swarm-manager ~]#gluster volume models start
[root@swarm-manager ~]#gluster volume models startforce
[root@swarm-manager ~]#gluster volume models status
[root@swarm-manager ~]#gluster volume models stop

總結(jié)

到此這篇關(guān)于CentOS7安裝GlusterFS集群的文章就介紹到這了,更多相關(guān)CentOS7安裝GlusterFS內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!

香港服務(wù)器租用

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶(hù)服務(wù)

7x24全年不間斷在線

專(zhuān)屬顧問(wèn)服務(wù)

1對(duì)1客戶(hù)咨詢(xún)顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部