适用于私有云、公有云、混合云,高性能集群(HPC),以及数据中心。但只可以是NAS的存储方式。

它是把源数据的索引表分布在不同的存储上,这样便会大大提高了效率。

支持异步及紧急模式下复制,可以用于广域网与互联网等。

在部署时是使用.iso的方式去部署,教室环境是rpm包的方式。

支持的节点数4-64个节点数,如果需要更多,请联系红帽。

安装需求环境:

1、         所有节点的时间必须是同步状态。

2、         所有的bricks必须是XFS文件系统

3、         如果是互用的话,存储大小必须一样。如果不一样的话,便会以小的为准。

Red hat storage_storage

红帽建议使用.iso的方式

强烈推荐把brick创建在逻辑卷上,并指定inode512字节,默认是256字节。

Volume type (七种)

1、         distributed分布式,没有冗余

2、         replicated复用,跨越在brick

3、         striped类似RAID 提升性能,没有冗余

4、         distributed-striped

5、         distributed-replicated

6、         striped-replicated

7、         distributed-striped-replicated

更多详情请看www.james-tw.com/jnote

服务器配置

一、在四个服务端上安装实施,首先安装以下软件包在以下节点上。

Red hat storage_glusterfs_02

/etc/init.d/glusterdrestart

chkconfig glusterdon

yum installxfsprogs –y XFS文件系统的软件包

每个节点步骤相同

二、在每个节点上创建一个逻辑卷,并格式化时,指定inode512字节,并且创建挂载点,再写入/etc/fstab里。

Node1node4命令一样,所以我就不再重复写了。

[root@node1 ~]#lvcreate -n brick1 -L 2G vgsrv

[root@node1 ~]#mkfs.xfs -i size=512 /dev/vgsrv/brick1

[root@node1 ~]#mkdir /n1_export1

Red hat storage_storage_03

每个节点建立挂载点n1_export1n1是节点号,其它为n2,n3,n4

mount –a

三、在一个节点上把其它三个加入到一个信任的存储组里。

gluster peer probenode2 这个只在一个节点上做就可以了。

Red hat storage_storage_04

四、查看节点状态

gluster peerstatus

Red hat storage_glusterfs_05

五、创建一个卷。

gluster volume create newvol replica 2 node1:/n1_export1 node2:/n2_export1

Red hat storage_glusterfs_06

六、创建完以后,启动这个新创建的卷。

gluster volumestart newvol

Red hat storage_glusterfs_07

七、查看这个新卷的状态,卷里只有node1node2

gluster volume status newvol

Red hat storage_storage_08

八、查看这个卷的信息

gluster volumeinfo newvol

Red hat storage_glusterfs_09

客户端配置

一、需要安装的软件包,只需安装这两个就够了,上面的是需要的依赖包。

glusterfs-3.3.0-22.el6rhs.x86_64.rpm

glusterfs-fuse-3.3.0-22.el6rhs.x86_64.rpm

二、建立挂载点,并挂载glusterfs 文件系统

mkdir /rh436

mount -t glusterfsnode1:/newvol /rh436

Red hat storage_glusterfs_10

Red hat storage_storage_11

三、测试复用模式

Clients:[root@desktop21~]# touch /rh436/test{0..9}

Server:node1node2也是如此。

Red hat storage_storage_12

再来测试一个

node2关机掉先

Red hat storage_glusterfs_13

在客户端上的挂载点里写一个数据,看看node2一会起来后会不会复用。

Red hat storage_storage_14

等待2重启以后,在节点1上给卷做一个健康状态的检查

gluster volumeheal newvol info

Red hat storage_storage_15

复用同步,若node1挂了,要做CTDB

gluster volume heal newvol

Red hat storage_glusterfs_16

已经有了

Red hat storage_storage_17Red hat storage_storage_18

扩展卷

一、查看卷的状态

gluster volumeinfo newvol

Red hat storage_glusterfs_19

二、添加brick到卷里。

gluster volumeadd-brick newvol node3:/n3_export1 node4:/n4_export1

Add Bricksuccessful

Red hat storage_storage_20

三、再次查看

gluster volumeinfo newvol

Red hat storage_storage_21

四、启动卷状态使得再次生效。

gluster volumerebalance newvol start

Red hat storage_storage_22

五、时时查看卷的状态

watch -n1  'gluster volume rebalance newvol status'

Red hat storage_glusterfs_23

替换brick

[root@node4 ~]#lvcreate -L 2G -n lvtest vgsrv

[root@node4 ~]#mkfs.xfs -i size=512 /dev/vgsrv/lvtest

[root@node4 ~]#mkdir /n4_export2

[root@node4 ~]#gluster volume replace-brick newvol node4:/n4_export1 node4:/n4_export2

 Start

Red hat storage_storage_24

gluster volumereplace-brick newvol node4:/n4_export1 node4:/n4_export2

 status

Red hat storage_storage_25

gluster volumereplace-brick newvol node4:/n4_export1 node4:/n4_export2

 commit

Red hat storage_glusterfs_26