glusterfs分佈式文件系統

第一:安裝依賴包:bash

yum install libibverbs librdmacm xfsprogs nfs-utils rpcbind libaio liblvm2app  lvm2-devel  libevent-devel  nfs-utils-lib-devel tcl-devel libsysfs-devel  userspace-rcu  atop  iozone  fio iperf服務器

 

安裝gluserfs server 和 client

yum install glusterfs glusterfs-server  glusterfs-fuse網絡

# yum install glusterfs-3.7.9-12 glusterfs-server-3.7.8-1.el7.x86_64app

yum -y install glusterfs glusterfs-clienttcp

8.組建集羣

/etc/init.d/glusterd start分佈式

chkconfig glusterd onspa

登錄服務器server1,執行命令線程

[root@server1 yum.repos.d]# gluster peer probe server2code

[root@server1 yum.repos.d]# gluster peer probe server3orm

 

使用 gluster peer status 查看狀態

 

 

 

9.建立卷

1.肯定建立卷的類型

2.去建立卷的brick列表

3.肯定建立卷的網絡類型(TCP/RDMA)

4.gluster volume create 建立複製卷,至少2臺主機

卷裏使用2臺主機

gluster volume create testvol replica 3  server1:/brick1/images  server2:/brick1/images 

 

 

#分佈式複製glusterfs卷,至少4臺主機

#gluster volume create fengvol replica 2 transport tcp  judge1:/data/feng judge2:/data/feng graph1:/data/feng graph2:/data/feng force

 

查看volume 卷信息

 

 

 

爲硬盤訪問設置權限:

Gluster volume set  testVol  auth.allow  172.16.1.*

 

啓動建立的卷

gluster  volume start   testVol

 

查看卷的擴展屬性

getfattr -d -m . -e hex  /brick1/images

 

 

客戶端掛載

mount  -t glusterfs  glusterfs1:/testvol    /data

 

cat /etc/fstab

glusterfs1:/testvol     /data       glusterfs   defaults  0   0

 

 

# 設置 cache 大小, 默認32MB $ gluster volume set testvol performance.cache-size 4GB # 設置 io 線程, 太大會致使進程崩潰 $ gluster volume set testvol performance.io-thread-count 16 # 設置 網絡檢測時間, 默認42s $ gluster volume set testvol network.ping-timeout 10 # 設置 寫緩衝區的大小, 默認1M $ gluster volume set testvol performance.write-behind-window-size 1024MB

 

 

 

查看卷

Gluster volume info

刪除卷

gluster volume stop testvol

gluster volume delete testvol

將機器移出集羣

gluster peer detach 172.28.26.102

只容許172.28.0.0的網絡訪問glusterfs

gluster volume set testvol auth.allow 172.28.26.*

 

 

 

 

加入新的機器並添加到卷裏(因爲副本數設置爲2,至少要添加2(四、六、8..)臺機器)

gluster peer probe 172.28.26.105

gluster peer probe 172.28.26.106

gluster volume add-brick testvol 172.28.26.105:/data/gluster 172.28.26.106:/data/gluster

 

 

收縮卷

# 收縮卷前gluster須要先移動數據到其餘位置

gluster volume remove-brick testvol 172.28.26.101:/data/gluster/testvol 172.28.26.102:/data/gluster/testvol start

# 查看遷移狀態

gluster volume remove-brick testvol 172.28.26.101:/data/gluster/testvol 172.28.26.102:/data/gluster/testvol status

# 遷移完成後提交

gluster volume remove-brick testvol 172.28.26.101:/data/gluster/testvol 172.28.26.102:/data/gluster/testvol commit

遷移卷

# 將172.28.26.101的數據遷移到,先將172.28.26.107加入集羣

gluster peer probe 172.28.26.107

gluster volume replace-brick testvol 172.28.26.101:/data/gluster/testvol 172.28.26.107:/data/gluster/testvol start

# 查看遷移狀態gluster volume replace-brick testvol 172.28.26.101:/data/gluster/testvol 172.28.26.107:/data/gluster/testvol status

# 數據遷移完畢後提交gluster volume replace-brick testvol 172.28.26.101:/data/gluster/testvol   172.28.26.107:/data/gluster/testvol   commit

# 若是機器172.28.26.101出現故障已經不能運行,執行強制提交而後要求gluster立刻執行一次同步

gluster volume replace-brick testvol   172.28.26.101:/data/gluster/testvol   172.28.26.102:/data/gluster/testvol   commit -force

gluster volume heal testvol  s full

 

 

移除集羣 gluster peer detach server3

相關文章
相關標籤/搜索