`
wenson
  • 浏览: 1041594 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

gluster3.2.x的安装配置

阅读更多

 

一、   GlusterFS 软件介绍

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

 

二、 Glusterfs安装介绍

1 环境安装需求介绍:
http://download.gluster.com/pub/gluster/glusterfs/3.2/Documentation/IG/html/ch02.html

假设 操作系统 centos5.5 版本以上

2 按照以下顺序安装相关 package——

 

2.1 服务器端和客户端都必须安装以下安装包

#GlusterFS 需要 fuse 支持库,需先安装 :
yum -y install  wget  fuse fuse-devel httpd-devel libibverbs-devel


2.2 确保左右机器的内网  TCP ports 111, 24007, 24008, 24009 (24009 + number of bricks across all volumes)  是开着的 如果有用 NFS,  还需要额外开  38465   38467 ports . 

Centos5.5/5.6还需要安装 rsync  python-ctypes ,执行:
yum -y install   rsync python-ctypes

 

2.3 必备软件:GlusterFs3.2. x (当前版本为 3.2.6)

http://www.gluster.org/download/ 下载以下 gluster组件:
glusterfs-core
glusterfs-fuse
glusterfs-geo-replication

执行 glusterfs安装:
sudo rpm -Uvh glusterfs-core--3.2. 6 -1.x86_64.rpm
sudo rpm -Uvh glusterfs-fuse--3.2.0-1..x86_64.rpm
sudo rpm -ivh glusterfs-geo-replication-3.2. 6 -1..x86_64.rpm

验证 GlusterFS 是不是安装成功使用下面命令:

glusterfs  version

出现下面信息表示安装成功 ;

glusterfs 3.2.6 built on Mar 10 2012 05:29:45

Repository revision: git://git.gluster.com/glusterfs.git

Copyright (c) 2006-2011 Gluster Inc. <http://www.gluster.com>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

You may redistribute copies of GlusterFS under the terms of the GNU General Public License.

启动 glusterd daemon

service glusterd start

停止 glusterd daemon

service glusterd stop

三、 配置 Glusterfs

glusterfs卷类型介绍

1、 Distributed Volumes

分布卷模式,卷中资源仅在一台服务器上存储,在存储池中非镜像或条带模式。

2、 Distributed Replicated Volumes

分布镜像卷模式:创建一个两两互为备份的卷,存储池中一块硬盘损坏,不会影响到数据的使用,最少需要两台服务器才能创建分布镜像卷。

3、 Distributed Striped Volumes

分布条带卷:每个文件分布在四台共享服务器上,通常用于大文件访问处理,最少需要 4 台服务器才能创建分布条带卷。

鉴于以上特点及我们公司的应用需求,我们选择第二种类型的 Volumes


1  前期准备

范例 :创建 volumes (以创建 4 台为例)

1.1、 在配置 GlusterFS volumes 之前,你需要创建一个包含存储服务器的存储池;而在创建存储池时必须每个存储服务器的 GlusterFS service 是开启的;

 

假设 4台server的hostname都设置好为:cmweb02、cmweb03、cmweb04、cmweb05,并在所有机器的/etc/hosts里设定好所有的hostname


创建存储池 peers 命令:

gluster peer probe  SERVER

SERVER表示存储服务器的 IP 地址 hostname

例如我要创建包含两台服务器的存储池使用命令如下:

# gluster peer probe  cmweb03

Probe successful

   注意 在创建存储池时,需要在主存储服务器依次创建附加服务器的peers,主服务器不需要添加。


查看peers是不是创建成功:

# gluster peer status

出现如下信息表示存储池创建成功:

Number of Peers: 1

 

Hostname:  cmweb03

Uuid:  5070f9cd-bb2f-49b7-a765-f0c04faf2240

State: Peer in Cluster ( Connected )

注意此信息中uuid必须是有值的,state处于连接状态,否则不能创建卷。

 

在各台server上创建sync server目录:
mkdir /opt/export 

2、 创建 Volume:

2. 1、 创建Distributed Volumes

# g luster volume create  cmwebvm  transport  tcp   cmweb02 : / opt/export/   cmweb03 :/ opt/export/ cmweb04 :/ opt/export/ cmweb05 :/ opt/export/

C reation of volume distribute has been successful

红色字体部分需要根据实际情况修改 ; cmwebvm 表示卷名; tcp 表示传输协议; cmweb02 表示

存储服务器 hostname / opt/export/ 表示存储服务器存储挂载点。

查看 volume  信息: # gluster volume info

Volume Name:  cmwebvm

Type:  distribute

Status: Started

Number of Bricks:  4

Transport-type: tcp

Bricks:

Brick1:  cmweb02 :/ opt/export

Brick2:  cmweb03 :/ opt/export

Brick 3 cmweb04 :/ opt/export

Brick 4 cmweb05 :/ opt/export

 

2.2 创建Replicated volumes

# g luster volume create  cmwebvm   replica  4  transport  tcp   cmweb02 : / opt/export/   cmweb03 :/ opt/export/ cmweb04 :/ opt/export/ cmweb05 :/ opt/export/

红色字体部分需要根据实际情况修改 ; cmwebvm 表示卷名; replica 表示卷类型; 4 表示以 4 为一组; tcp 表示传输协议; cmweb02 表示存储服务器 hostname / opt/export/ 表示存储服务器存储挂载点。

 

注: R eplicated volume s要求 2 个以上为一组才能创建。

查看 volume  信息: # gluster volume info

 

Volume Name:  cmwebvm

Type: Replicate

Status: Started

Number of Bricks:  4

Transport-type: tcp

Bricks:

Brick1:  cmweb02 :/ opt/export

Brick2:  cmweb03 :/ opt/export

Brick 3 cmweb04 :/ opt/export

Brick 4 cmweb05 :/ opt/export

2. 3、 创建Distributed  Striped Volumes

# g luster volume create  cmwebvm   stripe   4  transport  tcp   cmweb02 : / opt/export/   cmweb03 :/ opt/export/ cmweb04 :/ opt/export/ cmweb05 :/ opt/export/

红色字体部分需要根据实际情况修改 ; cmwebvm 表示卷名; stripe 表示卷类型; 4 表示以 4 个为一组; tcp 表示传输协议; cmweb02 表示存储服务器 hostname / opt/export/ 表示存储服务器存储挂载点。

注: Distributed  Strip ed volume s要求 2 个以上为一组才能创建;

查看 volume  信息: # gluster volume info

 

Volume Name:  cmwebvm

Type:  stripe

Status: Started

Number of Bricks:  4

Transport-type: tcp

Bricks:

Brick1:  cmweb02 :/ opt/export

Brick2:  cmweb03 :/ opt/export

Brick 3 cmweb04 :/ opt/export

Brick 4 cmweb05 :/ opt/export

 

2.4、启动停止volume

启动卷命令:

# gluster volume start  cmwebvm

停止卷命令

# gluster volume stop  cmwebvm

 

cmwebvm 表示卷名。

查看卷文件相关日志目录:

tail -f  /var/log/glusterfs/bricks / opt-export .log

红色字体可能因挂载点不同而有所改变需要注意。

 

2.5、增加挂载服务器

如果以后要添加服务器,可以使用add-brick命令:

gluster volume add-brick cmwebvm cmweb06:/opt/export cmweb07:/opt/export

 

3  客户端

3.1、  安装环境准备

fuse module的安装(建议在线安装)

运行如下命令进行安装:

$ yum install  openssh-server  wget   fuse    fuse-libs    openib    libibverbs

验证安装:

F use模块的验证:

$  modprobe fuse

$  dmesg | grep -i fuse

如果显示: fuse init (API version 7.1 0 ) ,则表示 fuse 模块安装成功


3.2、  挂载卷

客户端挂载存储服务器卷使用 指令

mount -t glusterfs -o log-level=WARNING,log-file=/var/log/gluster.log cmweb02:/cmwebvm /opt/clusterfs

 

cmweb02  表示主 serverIP

cmwebvm 表示卷名

/ opt/clusterfs 表示客户端挂载点

 

验证 mount 是否成功 指令:

 $ df 

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda3            219833192   1740060 206746024   1% /

/dev/sda1               194442     12191    172212   7% /boot

tmpfs                  4083736         0   4083736   0% /dev/shm

glusterfs#cmweb02:/cmwebvm

                     219833088   1740032 206745984   1% /opt/clusterfs

出现红色 字体部分表示已经挂载上存储服务器。

 

3.3、 卸载卷

$ umount  / opt/clusterfs


3.4、 如果要另外增加 client ,需确保机器上有安装好 glusterfs-fuse glusterfs- core,然后通过一下方法执行——

方法一:

glusterfs -f /etc/glusterfs/glusterfs.vol / opt/clusterfs  -l /var/log/glusterfs.log

方法二:

glusterfs -f $GLUSTERFSPATH/client.vol /mnt/glusterfs

 

四 相关文档

官方主页:

http://gluster.com/community/documentation/index.php/Main_Page

服务器安装:

http://gluster.com/community/documentation/index.php/Gluster_3.1_Filesystem_Installation_and_Configuration_Guide

客户端安装:

http://gluster.com/community/documentation/index.php/Gluster_3.1_Native_Client_Guide

挂载卷:

http://gluster.com/community/documentation/index.php/Gluster_3.1:_Mounting_Volumes

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics