美文网首页
glusterfs基本使用

glusterfs基本使用

作者: Joening | 来源:发表于2022-01-13 09:43 被阅读0次

    glusterfs部署及使用

    1.环境检查

    1.1检查防火墙

    systemctl stop firewalld #临时关闭防火墙
    systemctl disable firewalld #永久关闭防火墙 reboot生效 
    

    1.2 检查selinux

    setenforce 0 #临时关闭
    vim /etc/selinux/config #永久关闭 reboot生效
    SELINUX=disabled
    

    1.3 检查系统磁盘

    • 每个系统应该至少空余一块磁盘供glusterfs使用
    • 参考命令 lsblk -d fdisk -l
    [root@jdos-2-demo14 ~]# lsblk -d
    NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vdb  253:16   0 1000G  0 disk 
    vdc  253:32   0  100G  0 disk /node1
    vda  253:0    0  200G  0 disk 
    

    2.部署

    2.1 环境准备

    IP地址 roles 磁盘
    10.0.0.11 server 100G
    10.0.0.12 server 100G
    10.0.0.13 client

    2.2 server机器格式化

    mkfs.xfs -f /dev/xxxxxx  #磁盘名称 
    mkdir   -p  /node1     #创建挂载目录
    lsblk   #找到uuid号
    [root@jdos-2-demo14 ~]# cat /etc/fstab  | tail -1 #执行挂载动作
    UUID="7836d51c-e915-4911-b82f-c2e366ee7803" /node1               xfs      defaults      1 1 
    

    2.3 hosts 配置

    vim /etc/hosts 
    10.0.0.11 glusterfs-server1
    10.0.0.12  glusterfs-server2
    1.0.0.13  glusterfs-srever3
    #保存
    scp -rp root@/etc/hosts/   root@glusterfs-server2:/etc/hosts
    scp -rp root@/etc/hosts/   root@glusterfs-server3:/etc/hosts
    
    

    2.4 部署软件

    [root@jdos-2-demo14 ~]# mkdir -p /software
    [root@jdos-2-demo16 software]# ls -l
    total 3936
    -rw-r--r-- 1 root root  586372 Jan 12 18:16 glusterfs-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root  103628 Jan 12 18:16 glusterfs-api-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root  205932 Jan 12 18:16 glusterfs-cli-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root  991724 Jan 12 18:16 glusterfs-client-xlators-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root  146584 Jan 12 18:16 glusterfs-fuse-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root  415792 Jan 12 18:16 glusterfs-libs-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root   66980 Jan 12 18:16 glusterfs-rdma-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root 1393788 Jan 12 18:16 glusterfs-server-4.0.2-1.el7.x86_64.rpm
    -rw-r--r-- 1 root root   95148 Jan 12 18:16 userspace-rcu-0.10.0-3.el7.x86_64.rpm
    
    [root@jdos-2-demo16 software]# yum -y localinstall *.rpm  #执行安装
    [root@jdos-2-demo16 software]# systemctl start glusterd 
    [root@jdos-2-demo16 software]# systemctl enable glusterd
    [root@jdos-2-demo16 software]# systemctl status glusterd
    ● glusterd.service - GlusterFS, a clustered file-system server
       Loaded: loaded (/usr/lib/systemd/system/glusterd.service; enabled; vendor preset: disabled)
       Active: active (running) since Wed 2022-01-12 18:46:16 CST; 1h 8min ago
     Main PID: 22533 (glusterd)
       CGroup: /system.slice/glusterd.service
               ├─ 3465 /usr/sbin/glusterfsd -s jdos-2-demo16 --volfile-id dis-volume.jdos-2-demo16.node1 -p /var/run/gluster/vols/dis-volume/jdos...
               └─22533 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO
    
    Jan 12 18:46:16 jdos-2-demo16 systemd[1]: Starting GlusterFS, a clustered file-system server...
    Jan 12 18:46:16 jdos-2-demo16 systemd[1]: Started GlusterFS, a clustered file-system server.
    
    

    2.5 配置环境

    #在任意node节点上,将节点添加到存储信任池中
    [root@jdos-2-demo16 software]# gluster peer probe glusterfs-server2
    [root@jdos-2-demo16 software]# gluster peer status  #查看状态
    [root@jdos-2-demo16 software]# gluster peer status
    Number of Peers: 1
    
    Hostname: jdos-2-demo14
    Uuid: 5f08fba7-0408-456f-bc9c-766f842a899c
    State: Peer in Cluster (Connected)
    
    

    2.6 创建分布式卷

    # 创建
    [root@jdos-2-demo16 software]# gluster volume create dis-volume jdos-2-demo16:/node1  jdos-2-demo14:/node1  force
    
    #启动
    [root@jdos-2-demo16 software]# gluster volume  start dis-volume
    
    #查看
    [root@jdos-2-demo16 software]# gluster volume status dis-volume
    Status of volume: dis-volume
    Gluster process                             TCP Port  RDMA Port  Online  Pid
    ------------------------------------------------------------------------------
    Brick jdos-2-demo16:/node1                  49152     0          Y       3465 
    Brick jdos-2-demo14:/node1                  49152     0          Y       6769 
     
    Task Status of Volume dis-volume
    ------------------------------------------------------------------------------
    There are no active volume tasks
    
    

    2.7 客户端挂载

    [root@jdos-2-demo14 ~]# cat /etc/rc.local | tail -1
    mount -t glusterfs jdos-2-demo16:dis-volume /test/dis/ #挂载命令
    
    [root@jdos-2-demo14 ~]# df -h |tail -1  #查看是否挂载成功
    jdos-2-demo16:dis-volume                                               200G  2.1G  198G   2% /test/dis
    
    

    相关文章

      网友评论

          本文标题:glusterfs基本使用

          本文链接:https://www.haomeiwen.com/subject/ushncrtx.html