GlusterFS 3.7 源码安装部署

原创 赤水  2016年4月28日 09:08 阅读 362 次
简介:

    GlusterFS是Scale-Out存储解决方案Gluster的核心,它是一个开源的分布式文件系统,具有强大的横向扩展能力,通过扩展能够支持数PB存储容量和处理数千客户端。GlusterFS借助TCP/IP或InfiniBand RDMA网络将物理分布的存储资源聚集在一起,使用单一全局命名空间来管理数据。GlusterFS基于可堆叠的用户空间设计,可为各种不同的数据负载提供优异的性能


环境介绍:

	System:centos 6.5
	gluster_1	172.16.1.171
	gluster_2	172.16.1.162
	gluster_3	172.16.1.163


1 基础环境,配置hosts文件解析和时间同步,所有机器的hosts解析都一样

# tail -5 /etc/hosts
172.16.1.171 gluster_1
172.16.1.162 gluster_2
172.16.1.163 gluster_3

# echo "*/10 * * * * /usr/sbin/ntpdate asia.pool.ntp.org  &>/dev/null" >/var/spool/cron/root


2 在gluster-{1,3}上部署gluster软件

yum -y install http://mirrors.hustunique.com/epel//6/x86_64/epel-release-6-8.noarch.rpm
yum -y install flex-devel flex bison openssl-devel libxml2 libxml2-devel libacl-devel sqlite sqlite-devel python-devel git automake.noarch userspace-rcu userspace-rcu-devel systemtap-sdt-devel  gcc-c++

cd /usr/src/ ; wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/glusterfs-3.7.11.tar.gz
tar -zxvf glusterfs-3.7.11.tar.gz  ; cd glusterfs-3.7.11
./configure --prefix=/usr/local/glusterfs --enable-systemtap  && make && make install && echo ok || echo error 


echo "export PATH=$PATH:/usr/local/glusterfs/bin:/usr/local/glusterfs/sbin" >> /etc/profile
source /etc/profile


3 查看glusterfs 版本

# glusterfs --version		
glusterfs 3.7.11 built on Apr 26 2016 22:05:05
Repository revision: git://git.gluster.com/glusterfs.git
Copyright (c) 2006-2013 Red Hat, Inc. <http://www.redhat.com/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3
or later), or the GNU General Public License, version 2 (GPLv2),
in all cases as published by the Free Software Foundation.


4  启动glusterfs   

service glusterd restart ; netstat -nputl | egrep   glusterd ; chkconfig glusterd on


5 创建glusterfs 集群

# gluster peer probe 172.16.1.162
peer probe: success. 
# gluster peer probe 172.16.1.163
peer probe: success. 

# gluster peer status	#查看集群节点状态
Number of Peers: 2

Hostname: 172.16.1.162
Uuid: 0f4c5778-5520-4532-9710-3d96cbfe5e64
State: Peer in Cluster (Connected)

Hostname: 172.16.1.163
Uuid: dd622d65-1833-4c6d-b4f6-7ef0ba16a4aa
State: Peer in Cluster (Connected)


6 在 gluster_2,gluster_3 节点准备一块磁盘,格式化后挂在在 /gluster, 为后续存储做准备

mkfs.ext4 /dev/sdb ; mkdir /gluster
echo "/dev/sdb   /gluster    ext4   defaults   0 0" >> /etc/fstab 
mount -a ; df -h | egrep gluster

gluster volume create vol1 replica 2 172.16.1.162:/gluster/vol1 172.16.1.163:/gluster/vol1 


7 启用创建好的复制卷

# gluster volume start  vol1	#启动卷
# gluster volume info 	#查询卷详细信息
Volume Name: vol1
Type: Replicate
Volume ID: 718730e8-e014-4420-a6d2-4a242d5daa01
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 172.16.1.162:/gluster/vol1
Brick2: 172.16.1.163:/gluster/vol1
Options Reconfigured:
performance.readdir-ahead: on


8 客户端挂载(客户端也需要安装glusterfs,安装过程略):

mount -t glusterfs 172.16.1.171:/vol1 /test/	#挂在任意一个节点

搞定!


本文地址: http://blog.lssin.com/readblog/101.html
版权声明:本文为原创文章,版权归  赤水 所有,欢迎分享本文,转载请保留出处!

发表评论


表情