ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

GlusterFS常用维护操作命令

2022-09-04 14:32:48  阅读:182  来源: 互联网

标签:datavolume1 常用 操作命令 gluster quota volume GlusterFS brick idc1


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. 查看卷信息

gluster volume info

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>[stripe <COUNT> | replica <COUNT>] [transport [tcp | rdma | tcp,rdma]] <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 [all]

查看集群中的卷状态:
# gluster volume status [all]
# gluster volume status <VOLNAME> [detail| clients | mem | inode | fd]

查看本节点的文件系统信息:
# 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[brick <BRICK>] [list-cnt <COUNT>]

其中,open可以替换为read, write, opendir, readdir等。
查看每个 Brick 的读性能:

# gluster volume top <VOLNAME> read-perf [bs <BLOCK-SIZE> count <COUNT>] [brick <BRICK>] [list-cnt <COUNT>]

其中,read-perf可以替换为write-perf等。

15.GlusterFS优化

# 设置 cache 大小, 默认32MB
gluster volume set senyintvolume performance.cache-size 4GB

# 设置 io 线程, 太大会导致进程崩溃
gluster volume set senyintvolume performance.io-thread-count 16

# 设置 网络检测时间, 默认42s
gluster volume set senyintvolume network.ping-timeout 10

# 设置 写缓冲区的大小, 默认1M
gluster volume set senyintvolume performance.write-behind-window-size 1024MB

# 开启 指定 volume 的配额,不使用
gluster volume quota k8s-volume enable

# 限制 指定 volume 的配额,不使用
gluster volume quota k8s-volume limit-usage / 1TB

16.操作示例

  • 强制创建卷
gluster volume create testvol ip:/date/brick1 ip:/date/brick2 force
  • 磁盘限额
to quota glusterfs
主要是对挂载点下的某个目录进行空间限额(对客户端下某个目录限制,而不是对组成的空间进行的限制 如:server1目录、server2目录)

#gluster volume quota test-volume enable 激活quota功能

#gluster volume quota test-volume disable 关闭quota功能

#gluster volume quota test-volume limit-usage /data 10GB           ---/exp2/data 目录限制

#gluster volume quota test-volume list         ---quota信息列表

#gluster volume set test-volume features.quota-timeout 5  设置信息的超时时间

#gluster volume quota test-volume remove  /data  删除某个目录的quota设置
  • 添加存储节点
#gluster peer probe server4   向turst pool  添加新server4

#gluster volume add-brick test-volume server4:/server4  卷组添加新空间

gluster volume info 查看当前所有volume状态

#gluster volume rebalance test-volume start          对扩容后的卷组进行rebalance

#gluster volume rebalance test-volume status

#gluster volume rebalance test-volume stop
  • glusterfs的参数进行设置优化
#gluserfs volume set test-volume performance.cache-size 256M
  • 删除GlusterFS磁盘:
# gluster volume stop datavolume1
# gluster volume delete datavolume1
  • 卸载GlusterFS磁盘:
# gluster peer detach idc1-server4
  • ACL访问控制:
# gluster volume set datavolume1 auth.allow 10.100.1.*,10.200.1.*
  • 添加GlusterFS节点:
# gluster peer probe idc1-server5

# gluster peer probe idc1-server6

# gluster volume add-brick datavolume1 idc1-server5:/usr/local/share/datavolume1 idc1-server6:/usr/local/share/datavolume1
  • 迁移GlusterFS磁盘数据:
# gluster volume remove-brick datavolume1 idc1-server1:/usr/local/share/datavolume1 idc1-server5:/usr/local/share/datavolume1 start

# gluster volume remove-brick datavolume1 idc1-server1:/usr/local/share/datavolume1 idc1-server5:/usr/local/share/datavolume1 status

# gluster volume remove-brick datavolume1 idc1-server1:/usr/local/share/datavolume1 idc1-server5:/usr/local/share/datavolume1 commit
  • 数据重新分配:
# gluster volume rebalance datavolume1 start

# gluster volume rebalance datavolume1 status

# gluster volume rebalance datavolume1 stop
  • 修复GlusterFS磁盘数据(例如在idc1-server1宕机的情况下):
# gluster volume replace-brick datavolume1 idc1-server1:/usr/local/share/datavolume1 idc1-server5:/usr/local/share/datavolume1 commit -force

# gluster volume heal datavolume1 full

标签:datavolume1,常用,操作命令,gluster,quota,volume,GlusterFS,brick,idc1
来源: https://www.cnblogs.com/xiaohaoge/p/16655044.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有