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

[经验分享] CentOS6.4安装GlusterFS

[复制链接]

尚未签到

发表于 2015-9-10 03:41:16 | 显示全部楼层 |阅读模式
  主机分配:
  主机名             IP(Static)                        系统                                           配置                          角色

  gfs-server01    192.168.20.21    CentOS-6.4-x86_64-minimal         2CPU,4G,50G,1网卡          存储节点01

  gfs-server02    192.168.20.22    CentOS-6.4-x86_64-minimal         2CPU,4G,50G,1网卡          存储节点02
  gfs-client          192.168.20.20    CentOS-6.4-x86_64-minimal         2CPU,4G,50G,1网卡              客户端
  GlusterFS rpm下载地址:
  http://download.gluster.org/pub/gluster/glusterfs/LATEST/RHEL/epel-6/x86_64/

  Server端操作(192.168.20.21/22)
  1.安装

  (1).下载GlusterFS yum源:
  [iyunv@gfs-server01 ~]# yum -y install wget
  [iyunv@gfs-server01 ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
  (2).安装Gluster server:
  [iyunv@gfs-server01 ~]# yum -y install glusterfs-server glusterfs
  (3).启动Gluster server服务:
  [iyunv@gfs-server01 ~]# service glusterd start
  [iyunv@gfs-server01 ~]# chkconfig glusterd on
  gfs-server02采用同样步骤。
  2.配置
  (1).将两个存储节点添加到一个集群中,在其中一个存储节点操作即可,不用添加本机:

  [iyunv@gfs-server02 ~]# gluster peer probe 192.168.20.21
  (2).检查集群节点信息
  [iyunv@gfs-server02 ~]# gluster peer status
  Number of Peers: 1
  Hostname: 192.168.20.21
  Uuid: 81e52f87-9671-4f21-9e18-0213b4f4f2c9
  State: Peer in Cluster (Connected)
  [iyunv@vm-ha02 ~]#
  3440805e-95b0-4383-b59d-a58d1a79ab74
  (3).以/data/gluster为共享目录,创建名为volume-sql的卷,副本数为2

  [iyunv@gfs-server02 ~]# gluster volume create volume-sql replica 2 192.168.20.21:/data/gluster 192.168.20.22:/data/gluster
  (4).启动卷
  [iyunv@gfs-server02 ~]# gluster volume start volume-sql
  (5).查看卷状态
  [iyunv@gfs-server02 ~]# gluster volume info
  
  Volume Name: volume-sql
  Type: Replicate
  Volume ID: a9fea762-0b46-4a0b-aa8f-27d21bd258d2
  Status: Started
  Number of Bricks: 1 x 2 = 2
  Transport-type: tcp
  Bricks:
  Brick1: 192.168.20.21:/data/gluster
  Brick2: 192.168.20.22:/data/gluster
  

  Client端操作(192.168.20.20)

  1.安装
  (1).下载GlusterFS yum源:
  [iyunv@gfs-client ~]# yum -y install wget
  [iyunv@gfs-client ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
(2).安装Gluster client:
[iyunv@gfs-client ~]# yum -y install glusterfs glusterfs-fuse
  2.挂载
  (1).创建挂载目录

  [iyunv@gfs-client ~]# mkdir -p /openstack/mysql
  (2).使用glusterfs挂载(挂载任意一个储存节点即可)

  [iyunv@gfs-client ~]# mount -t glusterfs 192.168.20.21:/volume-sql /openstack/mysql
  [iyunv@gfs-client ~]# echo "192.168.20.21:/volume-sql /openstack/mysql glusterfs defaults,_netdev 0 0" >> /etc/fstab
  (3).使用NFS挂载(注意远端的rpcbind服务必须开启)
  [iyunv@gfs-client ~]# mount -t nfs -o mountproto=tcp,vers=3 192.168.20.21:/volume-sql /openstack/mysql
  [iyunv@gfs-client ~]# echo "192.168.20.21:/volume-sql /openstack/mysql nfs mountproto=tcp,vers=3 0 0“
  3.测试
  (1).拷贝文件到/openstack/mysql/
  [iyunv@gfs-client ~]# cp -av /root/centos6.4_20G.qcow2 /openstack/mysql/
  (2).存储节点上查看文件:
  [iyunv@gfs-server01 ~]# ls /data/gluster/
  centos6.4_20G.qcow2
  [iyunv@gfs-server01 ~]# md5sum /data/gluster/centos6.4_20G.qcow2
  94469f217dbe3cc54ebe2771b31d0fee  /data/gluster/centos6.4_20G.qcow2
  [iyunv@gfs-server02 ~]# ls /data/gluster/
[iyunv@gfs-server02 ~]# md5sum /data/gluster/centos6.4_20G.qcow2
94469f217dbe3cc54ebe2771b31d0fee  /data/gluster/centos6.4_20G.qcow2
  4.常用命令
  (1).删除卷

  [iyunv@gfs-servertest ~]# gluster volume stop volume-sql
  [iyunv@gfs-servertest ~]# gluster volume delete volume-sql
  (2).将存储节点移除集群
  [iyunv@gfs-servertest ~]# gluster peer detach 192.168.20.23
  (3).允许某些网段访问某个卷
  [iyunv@gfs-servertest ~]# gluster volume set volume-sql auth.allow 192.168.20.*
  (4).添加新存储节点到集群
  [iyunv@gfs-servertest ~]# gluster peer probe 192.168.20.24
  [iyunv@gfs-servertest ~]# gluster peer probe 192.168.20.25
  [iyunv@gfs-servertest ~]# gluster volume add-brick volume-sql 192.168.20.24:/data/gluster 192.168.20.25:/data/gluster
  (5).收缩卷
  先迁移数据到其他位置:
  [iyunv@gfs-servertest ~]# gluster volume remove-brick volume-sql 192.168.20.26:/data/gluster/volume-sql 192.168.20.27:/data/gluster/volume-sql start
  查看数据迁移状态:

  [iyunv@gfs-servertest ~]# gluster volume remove-brick volume-sql 192.168.20.26:/data/gluster/volume-sql 192.168.20.27:/data/gluster/volume-sql status
  迁移完成后提交:
  [iyunv@gfs-servertest ~]# gluster volume remove-brick volume-sql 192.168.20.26:/data/gluster/volume-sql 192.168.20.27:/data/gluster/volume-sql commit
  (6).迁移卷
  添加存储节点:

  [iyunv@gfs-servertest ~]# gluster peer probe 192.168.20.28
  开始卷迁移:
  [iyunv@gfs-servertest ~]# gluster volume replace-brick volume-sql 192.168.20.21:/data/gluster/volume-sql 192.168.20.28:/data/gluster/volume-sql start
  查看迁移状态:
  [iyunv@gfs-servertest ~]# gluster volume replace-brick volume-sql 192.168.20.21:/data/gluster/volume-sql 192.168.20.28:/data/gluster/volume-sql status
  迁移完毕后提交:

  [iyunv@gfs-servertest ~]# gluster volume replace-brick volume-sql 192.168.20.21:/data/gluster/volume-sql 192.168.20.28:/data/gluster/volume-sql commit
  如果机器192.168.20.21出现故障已经不能运行,执行强制提交然后Gluster马上执行一次同步:
  [iyunv@gfs-servertest ~]# gluster volume replace-brick img 192.168.20.21:/data/gluster/volume-sql 192.168.20.28:/data/gluster/volume-sql commit -force
  [iyunv@gfs-servertest ~]# gluster volume heal imgs full
  

运维网声明 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-111607-1-1.html 上篇帖子: GlusterFS + lagstash + elasticsearch + kibana 3 + redis日志收集存储系统部署 01 下篇帖子: centos 通过yum安装GlusterFS
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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