CentOS6.4安装GlusterFS

摘要:
主机分配:主机名IP(静态)系统配置角色gfs-server01192.168.20.21CentOS-6.4-x86 _ 64-minimal2CPU,4G,50G,1个网卡存储节点01gfs-server02192.168.20.22CentOS-6.4_x86 _ 64-minimal2CPU、4G,50B,1个网络卡存储节点02gfs-client192.168.20CentOS-6.4-

主机分配:

主机名             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源:

[root@gfs-server01 ~]# yum -y install wget

[root@gfs-server01 ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo

(2).安装Gluster server:

[root@gfs-server01 ~]# yum -y install glusterfs-server glusterfs

(3).启动Gluster server服务:

[root@gfs-server01 ~]# service glusterd start

[root@gfs-server01 ~]# chkconfig glusterd on

gfs-server02采用同样步骤。

2.配置

(1).将两个存储节点添加到一个集群中,在其中一个存储节点操作即可,不用添加本机:

[root@gfs-server02 ~]# gluster peer probe 192.168.20.21

(2).检查集群节点信息

[root@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)

[root@vm-ha02 ~]# 

3440805e-95b0-4383-b59d-a58d1a79ab74

(3).以/data/gluster为共享目录,创建名为volume-sql的卷,副本数为2

[root@gfs-server02 ~]# gluster volume create volume-sql replica 2 192.168.20.21:/data/gluster 192.168.20.22:/data/gluster

(4).启动卷

[root@gfs-server02 ~]# gluster volume start volume-sql

(5).查看卷状态

[root@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源:

[root@gfs-client ~]# yum -y install wget

[root@gfs-client ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo

(2).安装Gluster client:

[root@gfs-client ~]# yum -y install glusterfs glusterfs-fuse

2.挂载

(1).创建挂载目录

[root@gfs-client ~]# mkdir -p /openstack/mysql

(2).使用glusterfs挂载(挂载任意一个储存节点即可)

[root@gfs-client ~]# mount -t glusterfs 192.168.20.21:/volume-sql /openstack/mysql

[root@gfs-client ~]# echo "192.168.20.21:/volume-sql/openstack/mysql glusterfs defaults,_netdev 0 0" >> /etc/fstab

(3).使用NFS挂载(注意远端的rpcbind服务必须开启)

[root@gfs-client ~]# mount -t nfs -o mountproto=tcp,vers=3 192.168.20.21:/volume-sql /openstack/mysql

[root@gfs-client ~]# echo "192.168.20.21:/volume-sql /openstack/mysql nfs mountproto=tcp,vers=3 0 0

3.测试

(1).拷贝文件到/openstack/mysql/

[root@gfs-client ~]# cp -av /root/centos6.4_20G.qcow2 /openstack/mysql/

(2).存储节点上查看文件:

[root@gfs-server01 ~]# ls /data/gluster/

centos6.4_20G.qcow2

[root@gfs-server01 ~]# md5sum /data/gluster/centos6.4_20G.qcow2 

94469f217dbe3cc54ebe2771b31d0fee  /data/gluster/centos6.4_20G.qcow2

[root@gfs-server02 ~]# ls /data/gluster/

[root@gfs-server02 ~]# md5sum /data/gluster/centos6.4_20G.qcow2 

94469f217dbe3cc54ebe2771b31d0fee  /data/gluster/centos6.4_20G.qcow2

4.常用命令

(1).删除卷

[root@gfs-servertest ~]# gluster volume stop volume-sql

[root@gfs-servertest ~]# gluster volume delete volume-sql

(2).将存储节点移除集群

[root@gfs-servertest ~]# gluster peer detach 192.168.20.23

(3).允许某些网段访问某个卷

[root@gfs-servertest ~]# gluster volume set volume-sql auth.allow 192.168.20.*

(4).添加新存储节点到集群

[root@gfs-servertest ~]# gluster peer probe 192.168.20.24

[root@gfs-servertest ~]# gluster peer probe 192.168.20.25

[root@gfs-servertest ~]# gluster volume add-brick volume-sql192.168.20.24:/data/gluster 192.168.20.25:/data/gluster

(5).收缩卷

先迁移数据到其他位置:

[root@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

查看数据迁移状态:

[root@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

迁移完成后提交:

[root@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).迁移卷

添加存储节点:

[root@gfs-servertest ~]# gluster peer probe 192.168.20.28

开始卷迁移:

[root@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

查看迁移状态:

[root@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

迁移完毕后提交:

[root@gfs-servertest ~]# gluster volume replace-brick volume-sql 192.168.20.21:/data/gluster/volume-sql 192.168.20.28:/data/gluster/volume-sqlcommit

如果机器192.168.20.21出现故障已经不能运行,执行强制提交然后Gluster马上执行一次同步:

[root@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

[root@gfs-servertest ~]# gluster volume heal imgs full


免责声明:文章转载自《CentOS6.4安装GlusterFS》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇java模板、工厂设计模式在项目中的重构echarts实时数据图表下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

分布式文件系统MFS、Ceph、GlusterFS、Lustre的比较

MooseFS(MFS) Ceph GlusterFS Lustre Metadata server 单个MDS。存在单点故障和瓶颈。 多个MDS,不存在单点故障和瓶颈。MDS可以扩展,不存在瓶颈。 无,不存在单点故障。靠运行在各个节点上的动态算法来代替MDS,不需同步元数据,无硬盘I/O瓶颈。 双MDS(互相备份)。MDS不可以扩展,存在瓶颈。...

在Kubernetes中部署GlusterFS+Heketi

目录 简介 Gluster-Kubernetes 部署 环境准备 下载相关文件 部署glusterfs 部署heketi server端 配置heketi client 简介 在上一篇《独立部署GlusterFS+Heketi实现Kubernetes共享存储》中,我们说明了如何手动部署GlusterFS+Heketi来提供Kubernetes...

部署GlusterFS及Heketi

一、前言及环境 在实践kubernetes的StateFulSet及各种需要持久存储的组件和功能时,通常会用到pv的动态供给,这就需要用到支持此类功能的存储系统了。在各类支持pv动态供给的存储系统中,GlusterFS的设定比较简单,且数据安全性比较有保障,相较于ceph和NFS。 环境(gluster-server之间互信): 二、部署Gluste...