存储服务器主要提供基本的数据存储功能,客户端弥补了没有元数据服务器的问题,承担了更多的功能,包括数据卷管理、I/O 调度、文件定位、数据缓存等功能,利用 FUSE(File system in User Space)模块将 GlusterFS 挂载到本地文件系统之上,实现 POSIX 兼容的方式来访问系统数据。
下载 CentOS-Gluster-3.10.repo 放在/etc/yum.repos.d/目录下
下载 RPM-GPG-KEY-CentOS-SIG-Storage 放在/etc/pki/rpm-gpg/目录下
yum clean all
yum makecache 集群安装、配置
yum -y install glusterfs-server glusterfs glusterfs-fuse
service glusterd restar
#在服务端将gfs02、gfs03节点加入gluster集群中,并创建存储卷:[root@gfs01 ~]# gluster peer probe gfs02
[root@gfs01 ~]# gluster peer probe gfs03
#创建 条带复制卷
[root@gfs01 ~]# gluster volume create Main stripe 2 replica 2 transport tcp gfs02:/gluster_storage/storage01 gfs03:/gluster_storage/storage01 gfs02:/gluster_storage/storage02 gfs03:/gluster_storage/storage02 force
#启动
[root@gfs01 ~]# gluster volume start Main
#查看状态
[root@gfs01 ~]# gluster volume status
Status of volume: Main
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick gfs02:/gluster_storage/storage01 49152 0 Y 9233
Brick gfs03:/gluster_storage/storage01 49152 0 Y 9158
Brick gfs02:/gluster_storage/storage02 49153 0 Y 9252
Brick gfs03:/gluster_storage/storage02 49153 0 Y 9177
Self-heal Daemon on localhost N/A N/A Y 10239
Self-heal Daemon on gfs02 N/A N/A Y 9272
Self-heal Daemon on gfs03 N/A N/A Y 9197
Task Status of Volume Main
------------------------------------------------------------------------------
There are no active volume tasks
[root@gfs01 ~]# gluster peer status
Number of Peers: 2
Hostname: gfs03
Uuid: d7ab04f2-4358-4d1c-8aed-489aeae14a62
State: Peer in Cluster (Connected)
Hostname: gfs02
Uuid: ba07e12d-da70-4b6d-bcd1-5e340a97631b
State: Peer in Cluster (Connected) 挂载:
[root@gfs01 ~]# mkdir -p /gluster_storage/storage
[root@gfs01 ~]# mount -t glusterfs gfs01:/Main /gluster_storage/storage
#修改挂载文件:/etc/fstab,在文件末尾加入以下内容
gfs01:/Main /gluster_storage/storage glusterfs defaults,_netdev 0 0 测试:
[root@gfs01 ~]# cd /gluster_storage/storage/
[root@gfs01 storage]# time dd if=/dev/zero of=hello bs=1000M count=1
1+0 records in
1+0 records out
1048576000 bytes (1.0 GB) copied, 31.1961 s, 33.6 MB/s
real0m31.211s
user0m0.001s
sys0m1.139s 客户端查看: