zoukankan      html  css  js  c++  java
  • 安装配置Glusterfs

    192.168.1.11 10.1.1.241 glusterfs01 三块磁盘
    192.168.1.12 10.1.1.242 glusterfs02 三块磁盘
    192.168.1.13 10.1.1.243 glusterfs03 三块磁盘
    192.168.1.14 10.1.1.244 glusterfs-client
    关闭防火墙、selinux和时间同步
    安装依赖包

     yum install rpcbind libaio lvm2-devel -y
    [root@glusterfs01 ~]# cd Glusterfs-RPM安装包/
    [root@glusterfs01 Glusterfs-RPM安装包]# yum install glusterfs-*.rpm -y
    或者分开装:
    分区过程忽略
    [root@glusterfs01 ~]# mkdir /brick1 /brick2 #创建挂载目录
    [root@glusterfs01 ~]# mount /dev/sdb1 /brick1
    [root@glusterfs01 ~]# mount /dev/sdc1 /brick2
    vim  /etc/fastb或者/etc/rc.local
    [root@glusterfs01 ~]# /etc/init.d/glusterd start
    以上三个节点相同操作

    添加其他节点:

    [root@glusterfs01 ~]# gluster peer probe server2 #添加其他两台加入集群,只需要在一个节点操作
    [root@glusterfs01 ~]# gluster peer probe server3
    [root@glusterfs01 ~]# gluster peer  status #同时在其他节点查看
    [root@glusterfs01 ~]# gluster volume create testvo1 server1:/brick1/b1 #创建一个分布式卷,b1目录会自动创建,先使用一个节点,为后面扩展做准备
    [root@glusterfs03 ~]# gluster volume  start testvo1
    [root@glusterfs03 ~]# gluster volume status
    [root@glusterfs03 ~]# gluster volume info
    [root@glusterfs01 b1]# gluster volume status
    客户端挂载及测试
    [root@fluster-client ~]# mount -t glusterfs server1:/testvo1  /mnt
    [root@glusterfs01 ~]# gluster volume add-brick testvo1 server2:/brick1/b2 server3:/brick1/b3  #testvo1卷添加另外两个节点
    [root@glusterfs01 ~]# gluster volume info
    [root@fluster-client aa]# df -h  #客户端查看扩展前后挂载目录的大小
    客户端在测试添加一些数据到挂目录,看看节点上是否会有数据,已经分配是否均匀
    [root@glusterfs01 hehe]# gluster volume remove-brick testvo1 server3:/brick1/b3  #删除一个节点
    Removing brick(s) can result in data loss. Do you want to Continue? (y/n) y
    [root@glusterfs01 hehe]# gluster volume info 
    [root@fluster-client aa]# df -h  #客户端查看删除前后挂载目录的大小
    [root@glusterfs01 hehe]# gluster volume rebalance testvo1 start #做数据的负载均衡 
    [root@glusterfs03 hehe]# rm -rf /brick1/b3/ #将之前的删除节点加入卷,需要先删除之前的数据目录
    [root@glusterfs03 hehe]# gluster volume add-brick testvo1  server3:/brick1/b3 
    [root@glusterfs01 test]# gluster volume rebalance testvo1 start  #添加删除节点应当都需要做数据负载均衡
    删除卷,查看卷内的数据文件是否还在
    [root@fluster-client ~]# umount /mnt/ #客户端卸载挂载点
    [root@glusterfs01 test]# gluster volume stop testvo1
    [root@glusterfs01 test]# gluster volume delete   testvo1
    创建一个复制卷
    [root@glusterfs01 brick1]# gluster volume create testov1 replica 2 server1:/brick1/b1 server2:/brick1/b2
    [root@glusterfs01 brick1]# gluster volume start testov1
    [root@glusterfs01 brick1]# gluster volume info #查看Type 属性
    [root@fluster-client ~]# mount -t glusterfs server1:/testov1  /mnt #客户端挂载,查看挂载目录大小
    [root@fluster-client ~]# df -h #进入挂点添加一些数据,查看数据是否在两个节点中一致
    卷信息同步
    [root@glusterfs03 vols]# rm -rf /var/lib/glusterd/vols/testov1/ #删除节点三的卷信息(没个节点卷信息都是一致的,即使数据不一致)
    [root@glusterfs03 vols]# gluster volume sync server2 all #从节点2恢复卷信息
    [root@glusterfs03 vols]# ll #刚刚被删除的内容有恢复了
    #访问权限设置

    [root@glusterfs01 b1]# gluster volume set testov1 auth.allow 192.168.1.*   #允许访问(仅做IP访问控制,客户端已挂载需要重新挂载生效)
    [root@glusterfs01 b1]# gluster volume set testov1 auth.reject  10.1.1.*  #禁止访问,重新allow即可恢复被禁止的IP
    目录配额
    [root@glusterfs01 b1]# gluster volume create dhtvol  server1:/brick1/dht
    [root@glusterfs01 b1]# gluster volume start  dhtvol  
    [root@glusterfs01 b1]# gluster volume info dhtvol
    [root@fluster-client mnt]# mount -t glusterfs server1:/dhtvol  /media/ #客户端挂载
    [root@fluster-client mnt]# df -h
    [root@glusterfs01 b1]# gluster volume add-brick dhtvol server2:/brick1/dht #扩展卷的容量

     参考:https://www.cnblogs.com/huangyanqi/p/8406534.html

  • 相关阅读:
    正则表达式
    抽象
    面向对象
    this关键字
    http协议
    URL
    Ajax
    PHP命名空间
    PDO
    异常
  • 原文地址:https://www.cnblogs.com/panwenbin-logs/p/7807572.html
Copyright © 2011-2022 走看看