GFS 安裝使用


准備環境:

  1、OS:

    Centos:7.2x86_64

  2、主機

   server1: 192.168.30.41 wohaoshuai1
   server2: 192.168.30.42 wohaoshuai2
   server3: 192.168.30.43 wohaoshuai3

   client1:   192.168.30.43 wohaoshuai3

一、修改每台主機的host文件,在/etc/hosts下添加內容:

    192.168.30.41 wohaoshuai1
    192.168.30.42 wohaoshuai2
    192.168.30.43 wohaoshuai3

二、在wohaoshuai1、wohaoshuai2、wohaoshuai3分別安裝gfs server端(用yum安裝即可)

  1、安裝

    yum install centos-release-gluster -y

    yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma

  2、啟動gfsserver端並設置開機啟動    

    systemctl start glusterd.service

    systemctl enable glusterd.service

  3、添加wohaoshuai1,2,3到gfs集群(若為測試環境要關閉防火牆,否則會添加失敗,若需要開啟防火牆的情況下開放端口即可,默認端口為24007,在wohaoshuai1本機上不用添加)

    

    添加后查看集群狀態:

    

三、創建數據目錄

  1、在wohaoshuai1,2,3上都要創建 目錄為 /application/gluster/data

    mkdir -p /application/gluster/data

  2、創建卷(因為用的root用戶,所以后面需要加上force參數,Replica 3 表示的是3個備份,后面的是指定的存儲的目錄)

    gluster volume create wohaoshuai-gluster replica 3 transport tcp wohaoshuai1:/application/gluster/data wohaoshuai2:/application/gluster/data wohaoshuai3:/application/gluster/data force

    

  3、查看卷信息

    gluster volume info

    

  4、啟動創建的卷wohaoshuai-gluster

    gluster volume start wohaoshuai-gluster

    

    

四、客戶端掛載使用

  1、wohaoshuai3安裝client端

    yum install -y glusterfs glusterfs-fuse

  2、創建掛載路徑

    mkdir -p /application/gfsmount/

    mount -t glusterfs wohaoshuai1:wohaoshuai-gluster /application/gfsmount/

    查看掛載情況:

    

  3、此時就可對掛載的gfs盤進行讀寫。

五、關於gfs命令總結:

  Gluster peer status 查看所有的節點信息

  Gluster peer probe name添加節點

  Gluster peer detachname 刪除節點

  /etc/init.d/glusterstart 啟動gluster

  /etc/init.d/glusterstop 停止gluster

  /etc/init.d/glusterrestart 重啟gluster

  創建卷

    Gluster volume createxxx

    Gluster volume info 查看卷信息
    Gluster volume status 查看卷狀態

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM