亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    CentOS 7.5下部署GlusterFS分布式存儲(chǔ)集群環(huán)境

    最小化安裝的CentOS 7.5
    內(nèi)存大于1GB
    關(guān)閉selinux,防火墻端口放行(port:24007,111)(測試建議關(guān)閉firewalld)

    一、環(huán)境部署

    所有軟件包離線安裝,原因是yum安裝的不能很好的控制版,用到的軟件包統(tǒng)一放到/gfs目錄,包已整理好

    ——————————————分割線——————————————

    Matlab R2017b的Linux版下載地址可從以下信息的得到下載:

    點(diǎn)擊這個(gè)http://www.linuxidc.com/Linux/2013-12/93755.htm 鏈接關(guān)注 Linux公社官方微信,關(guān)注后回復(fù)數(shù)字158712。即可得到網(wǎng)友的分享密碼。

    如果取消關(guān)注Linux公社公眾號(hào),即使再次關(guān)注,也將無法提供本服務(wù)!

    鏈接: https://pan.baidu.com/s/1eSSX46yaGBUoEmCqjeAeqw 密碼:獲得見上面的方法,地址失效請?jiān)谙旅媪粞浴?/p>

    ——————————————分割線——————————————

    • 測試用的磁盤分配以及服務(wù)器架構(gòu)圖
      CentOS 7.5下部署GlusterFS分布式存儲(chǔ)集群環(huán)境

    • basic代表服務(wù)器本來使用的磁盤,基礎(chǔ)上再添加上圖相應(yīng)的磁盤,由于是測試用,為方便直觀理解,磁盤大小就是后面的數(shù)字:如sdb3,該磁盤大小為3GB。
    • 卷的分布方案

    卷名稱 卷類型 空間大小/GB  存儲(chǔ)塊
    dis-volume 分布式卷 12 node1(/sde6),node2(/sde6)
    stripe-volume 條帶卷 10 node1(/sdd5),node2(/sdd5)
    rep-volume 復(fù)制卷 5 node3(/sdd5),node4(/sdd5)
    dis-stripe 分布式條帶卷 12 node1(/sdb3),node2(/sdb3),node3(/sdb3),node4(/sdb3)
    dis-rep 分布式復(fù)制卷 8 node1(/sdc4),node2(/sdc4),node3(sdc4),node4(sdc4)
    • 全部主機(jī)修改主機(jī)名
    • 全部主機(jī)配置hosts文件,一樣的
    • 全部node主機(jī)創(chuàng)建掛載文件夾,依實(shí)際掛載點(diǎn)創(chuàng)建
    • 全部主機(jī)創(chuàng)建/gfs文件夾,將所需軟件包放入

      mkdir /{gfs,sdb3,sdc4,sdd5} cat /etc/hosts

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4  ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6  192.168.64.11 node1  192.168.64.12 node2  192.168.64.13 node3  192.168.64.14 node4  192.168.64.15 client
    • 完畢之后進(jìn)行ping測試
    • 通過傳輸方式將軟件包上傳到/gfs文件(里面有一個(gè)repo文件夾也要上傳)
    • 以上一切完成之后,全部node主機(jī)執(zhí)行以下腳本
    vim install.sh  #!/bin/bash  for i in $(fdisk -l | grep -wo "/dev/sd[b-z]" | sort)  do  dd if=/dev/zero of=$i bs=1024 count=1024  fdisk $i << EOF  n  p        w  EOF  #空行很重要不要?jiǎng)h除  partprobe $i   #//不重啟系統(tǒng)識(shí)別分區(qū)  mkfs.ext4 ${i}1   #//格式化分區(qū)  done    mkdir /b3 /c4 /d5 /e6   fdisk -l | grep -w "/dev/sd[b-z]" | sed -r 's/.*(/d.{8}).*/1/g' | sed -r 's/(.*)(.{3}):(.*)/mount 121 /23/' | bash  fdisk -l | grep -w "/dev/sd[b-z]" | sed -r 's/.*(/d.{8}).*/1/g' | sed -r 's/(.*)(.{3}):(.*)/121 /23 xfs default 0 0/' >> /etc/fstab  #-w 只顯示全字符合的列。  iptables -F  systemctl stop firewalld  setenforce 0    cat << EOF >> /etc/yum.repos.d/gfs.repo   [gfs]  name=gfs  baseurl=file:///gfs  gpgcheck=0  enabled=1  EOF    yum clean all && yum makecache  yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma  systemctl start glusterd  systemctl enable glusterd  EOF

    sh install.sh //執(zhí)行腳本 netstat -lnpt //查看gluster服務(wù)端口是否開啟
    腳本簡單理解

    • 再node1上執(zhí)行如下命令構(gòu)建gluster集群
    [root@node1 ~]# gluster peer probe node2  peer probe: success.   [root@node1 ~]# gluster peer probe node3  peer probe: success.   [root@node1 ~]# gluster peer probe node4  peer probe: success. 

    [root@node1 ~]# gluster peer status //在每個(gè)節(jié)點(diǎn)上執(zhí)行查看集群狀態(tài);正常時(shí)為(Connected)

    二、創(chuàng)建卷

    1.創(chuàng)建分布式卷(擴(kuò)大磁盤空間,讀寫速度快,沒有容錯(cuò)能力)

    [root@node1 ~]# gluster volume create dis-volume node1:/sde6 node2:/sde6 force //dis-volume為卷名稱,未指定創(chuàng)建卷類型,默認(rèn)為分布式卷 volume create: dis-volume: success: please start the volume to access data [root@node1 ~]# gluster volume start dis-volume volume start: dis-volume: success [root@node1 ~]# gluster volume info dis-volume //查看該卷的相關(guān)信息

    2.創(chuàng)建條帶卷(以數(shù)據(jù)塊為單位存儲(chǔ),沒有容錯(cuò)性)

    [root@node1 ~]# gluster volume create stripe-volume stripe 2 node1:/sdd5 node2:/sdd5 force [root@node1 ~]# gluster volume start stripe-volume volume start: stripe-volume: success //stripe表示卷類型條帶卷,后面的數(shù)量表示條帶數(shù)

    3.創(chuàng)建復(fù)制卷(磁盤空間為總空間一半,具備容錯(cuò)性,讀快,寫慢)

    [root@node1 ~]# gluster volume create rep-volume replica 2 node3:/sdd5 node4:/sdd5 force [root@node1 ~]# gluster volume start rep-volume volume start: rep-volume: success

    4.創(chuàng)建分布式條帶卷(加大容量,讀取快,沒有容錯(cuò)性)

    [root@node1 ~]# gluster volume create dis-stripe stripe 2 node1:/sdb3 node2:/sdb3 node3:/sdb3 node4:/sdb3 force //指定類型為Distributed-Stripe,數(shù)值為2,而且后面跟了4個(gè)Brick Server,是2的2倍,所以創(chuàng)建的是分布式條帶卷。 volume create: dis-stripe: success: please start the volume to access data [root@node1 ~]# gluster volume start dis-stripe volume start: dis-stripe: success

    5.創(chuàng)建分布式復(fù)制卷(擴(kuò)展空間,總空間的一半,且具有容錯(cuò)能力)

    [root@node1 ~]# gluster volume create dis-rep replica 2 node1:/sdc4 node2:/sdc4 node3:/sdc4 node4:/sdc4/ force //指定類型為Distributed-Replicate,數(shù)值為2,而且后面跟了4個(gè)Brick Server,是2的2倍,所以創(chuàng)建的是分布式復(fù)制卷。 volume create: dis-rep: success: please start the volume to access data [root@node1 ~]# gluster volume start dis-rep volume start: dis-rep: success

    三、部署Gluster客戶端

    1.安裝客戶端軟件
    • 將軟件包放至/gfs文件夾
    • 修改前面提到的hostname以及hosts
    • 運(yùn)行如下腳本
    vim in_cl.sh  #!/bin/bash    cat << EOF >> /etc/yum.repos.d/gfs.repo   [gfs]  name=gfs  baseurl=file:///gfs  gpgcheck=0  enabled=1  EOF    yum clean all && yum makecache  yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma  systemctl start glusterd  systemctl enable glusterd

    sh in_cl.sh netstat -lnpt | grep glu //可以看到服務(wù)已經(jīng)啟動(dòng)
    [root@client ~]# mkdir -pv /test/{dis,stripe,rep,dis_stripe,dis_rep} //創(chuàng)建掛載目錄 [root@client ~]# mount -t glusterfs node1:dis-volume /test/dis [root@client ~]# mount -t glusterfs node1:stripe-volume /test/stripe/ [root@client ~]# mount -t glusterfs node1:rep-volume /test/rep/ [root@client ~]# mount -t glusterfs node1:dis-stripe /test/dis_stripe/ [root@client ~]# mount -t glusterfs node1:dis-rep /test/dis_rep/ //掛載glusterfs文件系統(tǒng)到本地客戶端,所制定的node1節(jié)點(diǎn)只是為了獲取配置信息,不代表只和他進(jìn)行數(shù)據(jù)傳輸,會(huì)根據(jù)配置針對集群來進(jìn)行數(shù)據(jù)的存放

    • 修改fstab文件實(shí)現(xiàn)永久掛載
    • 添加如下文件

      vim /etc/fstab

    node1:dis-volume        /test/dis               glusterfs defaults,_netdev 0 0  node1:stripe-volume     /test/stripe            glusterfs defaults,_netdev 0 0  node1:rep-volume        /test/rep               glusterfs defaults,_netdev 0 0  node1:dis-rep           /test/dis_rep   glusterfs defaults,_netdev 0 0  node1:dis-stripe        /test/dis_stripe        glusterfs defaults,_netdev 0 0

    四、測試

    • 生成測試文件(該文件雖沒有數(shù)據(jù),但是可以進(jìn)行測試用途)

      [root@client ~]# for i in {1..5};do dd if=/dev/zero of=/root/demon$i.log bs=1M count=43;done [root@client ~]# cp demon* /test/dis && cp demon* /test/dis_rep/ && cp demon* /test/dis_stripe/ && cp demon* /test/rep/ && cp demon* /test/stripe/

    • 查看文件分布狀態(tài)
    • 分布式卷(node1和node2的/sde6目錄查看,可以看到文件被分散開存放)
    [root@node1 ~]# ll -h /sde6/  總用量 130M  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon1.log  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon3.log  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon4.log  drwx------. 2 root root 16K 4月   3 2019 lost+found  [root@node2 ~]# ll -h /sde6/  總用量 87M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon5.log  drwx------. 2 root root 16K 4月   3 03:01 lost+found
    • 條帶卷(node1和node2的/sdd5目錄查看,清晰看到是以數(shù)據(jù)塊為單位存儲(chǔ)的)
    [root@node1 ~]# ls -lh /sdd5/  總用量 108M  -rw-r--r--. 2 root root 22M 4月   2 21:31 demon1.log  -rw-r--r--. 2 root root 22M 4月   2 21:31 demon2.log  -rw-r--r--. 2 root root 22M 4月   2 21:31 demon3.log  -rw-r--r--. 2 root root 22M 4月   2 21:31 demon4.log  -rw-r--r--. 2 root root 22M 4月   2 21:31 demon5.log  [root@node2 ~]# ls -lh /sdd5/  總用量 108M  -rw-r--r--. 2 root root 22M 4月   3 05:31 demon1.log  -rw-r--r--. 2 root root 22M 4月   3 05:31 demon2.log  -rw-r--r--. 2 root root 22M 4月   3 05:31 demon3.log  -rw-r--r--. 2 root root 22M 4月   3 05:31 demon4.log  -rw-r--r--. 2 root root 22M 4月   3 05:31 demon5.log
    • 復(fù)制卷(node3和node4的/sdd5目錄,數(shù)據(jù)有備份)
    [root@node3 ~]# ls -lh /sdd5/  總用量 216M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon1.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon3.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon4.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon5.log  drwx------. 2 root root 16K 4月   3 03:03 lost+found  [root@node4 ~]# ls -lh /sdd5/  總用量 216M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon1.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon3.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon4.log  -rw-r--r--. 2 root root 43M 4月   3 05:33 demon5.log  drwx------. 2 root root 16K 4月   3 02:55 lost+found
    • 分布式條帶卷(節(jié)點(diǎn)1、2、3、4的/sdb3目錄,我日期沒有調(diào)整,海涵)
    [root@node1 ~]# ls -lh /sdb3/  總用量 65M  -rw-r--r--. 2 root root 22M 4月   2 21:32 demon1.log  -rw-r--r--. 2 root root 22M 4月   2 21:32 demon3.log  -rw-r--r--. 2 root root 22M 4月   2 21:32 demon4.log  drwx------. 2 root root 16K 4月   2 18:37 lost+found  [root@node2 ~]# ls -lh /sdb3/  總用量 65M  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon1.log  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon3.log  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon4.log  drwx------. 2 root root 16K 4月   3 03:01 lost+found  [root@node3 ~]# ls -lh /sdb3/  總用量 44M  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon5.log  drwx------. 2 root root 16K 4月   3 03:03 lost+found  [root@node4 ~]# ls -lh /sdb3/  總用量 44M  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 22M 4月   3 05:32 demon5.log  drwx------. 2 root root 16K 4月   3 02:55 lost+found
    • 分布式復(fù)制卷(節(jié)點(diǎn)1、2、3、4的/sdc4目錄,可看到文件沒有被分片,但是是分布開來存放的)
    [root@node1 ~]# ls -lh /sdc4/  總用量 130M  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon1.log  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon3.log  -rw-r--r--. 2 root root 43M 4月   2 21:32 demon4.log  drwx------. 2 root root 16K 4月   3 2019 lost+found  [root@node2 ~]# ls -lh /sdc4/  總用量 130M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon1.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon3.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon4.log  drwx------. 2 root root 16K 4月   3 03:01 lost+found  [root@node3 ~]# ls -lh /sdc4/  總用量 87M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon5.log  drwx------. 2 root root 16K 4月   3 03:01 lost+found  [root@node4 ~]# ls -lh /sdc4/  總用量 87M  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon2.log  -rw-r--r--. 2 root root 43M 4月   3 05:32 demon5.log  drwx------. 2 root root 16K 4月   3 03:01 lost+found
    破壞測試
    • 直接點(diǎn)關(guān)閉node2節(jié)點(diǎn)。關(guān)機(jī)操作。
    • 客戶端操作
    [root@client ~]# ls /test/dis/  demon1.log  demon3.log  demon4.log  lost+found  //可以看到另外兩個(gè)文件直接找不到了  [root@client ~]# ls /test/stripe/  [root@client ~]#   //條帶卷因?yàn)槲募际欠稚㈤_放,所以都沒有了  [root@client ~]# ls /test/dis_stripe/  demon2.log  demon5.log  lost+found  //分布式條帶卷,因?yàn)槭欠植际酱鎯?chǔ)node2宕機(jī)導(dǎo)致數(shù)據(jù)不完整不會(huì)顯示,1,3,4號(hào)文件丟失  [root@client ~]# ls /test/dis_rep/  demon1.log  demon2.log  demon3.log  demon4.log  demon5.log  lost+found  //分布式復(fù)制卷完全不受任何影響  //總而言之,了解各卷的特點(diǎn),再細(xì)心觀察以下文件分布的具體位置,才能盡可能保證數(shù)據(jù)可靠性

    五、維護(hù)命令

    [root@node3 ~]# gluster volume list  dis-rep  dis-stripe  dis-volume  rep-volume  stripe-volume  //任何一個(gè)節(jié)點(diǎn)都可以查看集群列表  [root@node1 ~]# gluster volume info   //查看所有卷的信息  [root@node1 ~]# gluster volume status         //查看卷的狀態(tài)  [root@node3 ~]# gluster volume stop dis-stripe  Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y  volume stop: dis-stripe: success  //停止卷  [root@node3 ~]# gluster volume start dis-stripe  //啟動(dòng)卷  [root@node3 ~]# gluster volume delete dis-stripe  //刪除卷
    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)