yunvn 发表于 2015-9-9 14:31:29

GlusterFS常用命令

  1、启动/关闭/查看glusterd服务
  # /etc/init.d/glusterd start
  # /etc/init.d/glusterd stop
  # /etc/init.d/glusterd status
  2、 开机自动启动glusterd服务
  # chkconfig glusterd on # Red Hat
  # update-rc.d glusterd defaults # Debian
  # echo "glusterd" >>/etc/rc.local # Others
  3、查看配置信息
  # cat /etc/rc.local
  4、为存储池添加/移除服务器节点
  在其中一个节点上操作即可:
  # gluster peer probe <SERVER>
  # gluster peer detach <SERVER>
  注意,移除节点时,需要提前将该节点上的Brick移除。
  查看所有节点的基本状态(显示的时候不包括本节点):
  # gluster peer status
  5、 挂载分区
  # mount -t ext4 /dev/sdd1 /mnt/brick1
  6、 创建/启动/停止/删除卷
  # gluster volume create <NEW-VOLNAME> ] <NEW-BRICK1> <NEW-BRICK2> <NEW-BRICK3> <NEW-BRICK4>...
  # gluster volume start <VOLNAME>
  # gluster volume stop <VOLNAME>
  # gluster volume delete <VOLNAME>
  注意,删除卷的前提是先停止卷。
  7、 客户端以glusterfs方式挂载
  # mount -t glusterfs <SERVER>:/<VOLNAME><MOUNTDIR>
  对于OpenStack,计算和控制节点都要挂载/var/lib/nova/instances,控制节点还要挂载/var/lib/glance/images。
  8、 查看卷信息
  列出集群中的所有卷:
  # gluster volume list
  查看集群中的卷信息:
  # gluster volume info
  查看集群中的卷状态:
  # gluster volume status
  # gluster volume status <VOLNAME>
  查看本节点的文件系统信息:
  # df -h [<MOUNT-PATH>]
  查看本节点的磁盘信息:
  # fdisk -l
  9、配置卷
  # gluster volume set <VOLNAME> <OPTION> <PARAMETER>
  10.    扩展卷
  # gluster volume add-brick <VOLNAME> <NEW-BRICK>
  注意,如果是复制卷或者条带卷,则每次添加的Brick数必须是replica或者stripe的整数倍。
  11.    收缩卷
  先将数据迁移到其它可用的Brick,迁移结束后才将该Brick移除:
  # gluster volume remove-brick <VOLNAME> <BRICK> start
  在执行了start之后,可以使用status命令查看移除进度:
  # gluster volume remove-brick <VOLNAME> <BRICK> status
  不进行数据迁移,直接删除该Brick:
  # gluster volume remove-brick <VOLNAME> <BRICK> commit
  注意,如果是复制卷或者条带卷,则每次移除的Brick数必须是replica或者stripe的整数倍。
  12.    迁移卷
  使用start命令开始进行迁移:
  # gluster volume replace-brick <VOLNAME> <BRICK> <NEW-BRICK> start
  在数据迁移过程中,可以使用pause命令暂停迁移:
  # gluster volume replace-brick <VOLNAME> <BRICK> <NEW-BRICK> pause
  在数据迁移过程中,可以使用abort命令终止迁移:
  # gluster volume replace-brick <VOLNAME> <BRICK> <NEW-BRICK> abort
  在数据迁移过程中,可以使用status命令查看迁移进度:
  # gluster volume replace-brick <VOLNAME> <BRICK> <NEW-BRICK> status
  在数据迁移结束后,执行commit命令来进行Brick替换:
  # gluster volume replace-brick <VOLNAME> <BRICK> <NEW-BRICK> commit
  13.    重新均衡卷
  不迁移数据:
  # gluster volume rebalance <VOLNAME> lay-outstart
      # gluster volume rebalance <VOLNAME> start
  # gluster volume rebalance <VOLNAME> startforce
  # gluster volume rebalance <VOLNAME> status
  # gluster volume rebalance <VOLNAME> stop
  14.    系统扩展维护
  开启/关闭系统配额:
  # gluster volume quota <VOLNAME> enable | disable
  设置目录配额:
    # gluster volume quota <VOLNAME> limit-usage <DIR> <VALUE>
  查看配额:
    # gluster volume quota <VOLNAME> list [<DIR>]
  地域复制(geo-replication):
  # gluster volume geo-replication <MASTER> <SLAVE> start | status | stop
  IO信息查看:
  # gluster volume profile <VOLNAME> start | info | stop
  Top监控:
  Top命令允许你查看Brick的性能,例如:read,write, file open calls, file read calls, file write calls, directory opencalls, and directory real calls。所有的查看都可以设置 top数,默认100。
  查看打开的 fd:
  # gluster volume top <VOLNAME> open
  其中,open可以替换为read, write, opendir, readdir等。
  查看每个 Brick 的读性能:
  # gluster volume top <VOLNAME> read-perf
  其中,read-perf可以替换为write-perf等
  
页: [1]
查看完整版本: GlusterFS常用命令