设为首页 收藏本站
查看: 3947|回复: 0

[经验分享] Glusterfs 扩容、缩减

[复制链接]

尚未签到

发表于 2019-2-1 10:36:01 | 显示全部楼层 |阅读模式
  

  对于一个存储,不可避免的会遇到扩容、缩减存储容量的问题。
  1 为Glusterfs扩容
  提前准备好了一个gluster volume:
[root@node01 ~]# gluster volume info repvol
Volume Name: repvol
Type: Replicate
Volume ID: 7015b7fe-8039-4d5d-b698-e8321df5289c
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node01.lab.example.com:/bricks/thinvol1/brick
Brick2: node02.lab.example.com:/bricks/thinvol1/brick
Options Reconfigured:
performance.stat-prefetch: off
storage.batch-fsync-delay-usec: 0
server.allow-insecure: on
performance.readdir-ahead: on
transport.address-family: inet
nfs.disable: on  可以看出repvol是一个包含2个brick的1x2复制卷,将repvol挂载到node02 server上,并写入一些数据以作测试。
[root@node02 ~]# mount -t cifs //node01.lab.example.com/gluster-repvol -o user=smbuser,pass=redhat /mnt[root@node02 ~]# cd /mnt
[root@node02 mnt]# ls
[root@node02 mnt]# touch {1..100}.file  使用如下命令为repvol再增加两个brick
[root@node01 ~]# gluster volume add-brick repvol node01.lab.example.com:/bricks/thinvol2/brick node02.lab.example.com:/bricks/thinvol2/brick
volume add-brick: success[root@node01 ~]# gluster volume info repvol
Volume Name: repvol
Type: Distributed-Replicate
Volume ID: 7015b7fe-8039-4d5d-b698-e8321df5289c
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node01.lab.example.com:/bricks/thinvol1/brick
Brick2: node02.lab.example.com:/bricks/thinvol1/brick
Brick3: node01.lab.example.com:/bricks/thinvol2/brick
Brick4: node02.lab.example.com:/bricks/thinvol2/brick
Options Reconfigured:
performance.stat-prefetch: off
storage.batch-fsync-delay-usec: 0
server.allow-insecure: on
performance.readdir-ahead: on
transport.address-family: inet
nfs.disable: on  可以看到repvol已经变成了一个2x2的分布式复制卷,扩容后我们还需要把原有的数据rebalance
[root@node01 ~]# gluster volume rebalance repvol start
volume rebalance: repvol: success: Rebalance on repvol has been started successfully. Use rebalance status command to check status of the rebalance process.
ID: a8fba779-6c2d-449b-8847-58aeb2ae1798[root@node01 ~]# gluster volume rebalance repvol status
                                    Node Rebalanced-files          size       scanned      failures       skipped               status  run time in h:m:s
                               ---------      -----------   -----------   -----------   -----------   -----------         ------------     --------------
                               localhost               48        0Bytes           100             0             0            completed        0:0:5
                                  node02                0        0Bytes             0             0             0            completed        0:0:2
volume rebalance: repvol: success  这里有一个需要注意的地方,当数据量太大的时候,对数据进行rebalance必须要考虑的一个问题就是性能,不能因为数据rebalance而影响我们的存储的正常使用。Glusterfs也考虑到了这个问题,在进行数据rebalance时,根据实际场景不同设计了三种不同的“级别”:
  1)lazy:每次仅可以迁移一个文件
2)normal:默认设置,每次迁移2个文件或者是(CPU逻辑个数-4)/2,哪个大,选哪个
3)aggressive:每次迁移4个文件或者是(CPU逻辑个数-4)/2
  通过以下命令进行配置:
  gluster volume set VOLUME-NAME cluster.rebal-throttle [lazy|normal|aggressive]
  如将volume repvol设置为lazy
[root@node01 ~]# gluster volume set repvol cluster.rebal-throttle lazy
volume set: success  

  2 缩减volume大小
  将我们刚刚添加的2个brick再从volume repovl中删掉
[root@node01 ~]# gluster volume remove-brick repvol node01.lab.example.com:/bricks/thinvol2/brick node02.lab.example.com:/bricks/thinvol2/brick start
volume remove-brick start: success
ID: db72aaf8-e60d-4e56-be60-54469df9c233[root@node01 ~]# gluster volume remove-brick repvol node01.lab.example.com:/bricks/thinvol2/brick node02.lab.example.com:/bricks/thinvol2/brick status
                                    Node Rebalanced-files          size       scanned      failures       skipped               status  run time in h:m:s
                               ---------      -----------   -----------   -----------   -----------   -----------         ------------     --------------
                               localhost               48        0Bytes           101             0             0            completed        0:0:3
                                  node02                0        0Bytes             0             0             0            completed        0:0:1[root@node01 ~]# gluster volume remove-brick repvol node01.lab.example.com:/bricks/thinvol2/brick node02.lab.example.com:/bricks/thinvol2/brick commit
Removing brick(s) can result in data loss. Do you want to Continue? (y/n) y
volume remove-brick commit: success
Check the removed bricks to ensure all files are migrated.
If files with data are found on the brick path, copy them via a gluster mount point before re-purposing the removed brick.  此时再看repvol已经重新变为1x2的复制卷了
[root@node01 ~]# gluster volume info repvol
Volume Name: repvol
Type: Replicate
Volume ID: 7015b7fe-8039-4d5d-b698-e8321df5289c
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node01.lab.example.com:/bricks/thinvol1/brick
Brick2: node02.lab.example.com:/bricks/thinvol1/brick
Options Reconfigured:
cluster.rebal-throttle: lazy
performance.stat-prefetch: off
storage.batch-fsync-delay-usec: 0
server.allow-insecure: on
performance.readdir-ahead: on
transport.address-family: inet
nfs.disable: on[root@node01 ~]# ls /bricks/thinvol1/brick/ | wc -w
100  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-670358-1-1.html 上篇帖子: glusterfs初步实践一(类似NFS) 下篇帖子: centos7 搭建GlusterFS
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表