使用GlusterFS在四个存储节点上的分布式存储在CentOS 5.4上

使用GlusterFS在四个存储节点上分布式存储在CentOS 5.4上

本教程将介绍如何将四个单一存储服务器(运行CentOS 5.4)与GlusterFS组合到一个大型存储服务器(分布式存储)。 客户端系统(CentOS 5.4)将能够访问存储,就像它是本地文件系统一样。 GlusterFS是一种能够缩放到几个peta字节的集群文件系统。 它将Infiniband RDMA或TCP / IP互连的各种存储砖聚合成一个大型并行网络文件系统。 存储砖可以由诸如具有SATA-II RAID和Infiniband HBA的x86_64服务器的任何商品硬件制成。

请注意,这种存储(分布式存储)不提供任何高可用性功能,如复制存储的情况。

我不会保证这将为您工作!

1初步说明

在本教程中,我使用五个系统,四个服务器和一个客户端:

  • server1.example.com:IP地址192.168.0.100 (服务器)
  • server2.example.com:IP地址192.168.0.101 (服务器)
  • server3.example.com:IP地址192.168.0.102 (服务器)
  • server4.example.com:IP地址192.168.0.103 (服务器)
  • client1.example.com:IP地址192.168.0.104 (客户端)

所有五个系统应该能够解析其他系统的主机名。 如果这不能通过DNS完成,您应该编辑/ etc / hosts文件,使其在所有五个系统上包含以下行:

vi /etc/hosts
[...]
192.168.0.100   server1.example.com     server1
192.168.0.101   server2.example.com     server2
192.168.0.102   server3.example.com     server3
192.168.0.103   server4.example.com     server4
192.168.0.104   client1.example.com     client1
[...]

(也可以在以下设置中使用IP地址而不是主机名,如果您希望使用IP地址,则不需要关心主机名是否可以解决。)

2设置GlusterFS服务器

server1.example.com/server2.example.com/server3.example.com/server4.example.com:

GlusterFS不可用作CentOS 5.4的软件包,因此我们必须自己构建它。 首先我们安装先决条件:

yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
yum install libibverbs-devel fuse-devel

然后我们从http://www.gluster.org/download.php下载最新的GlusterFS版本, 并按如下所示构建:

cd /tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.9.tar.gz
tar xvfz glusterfs-2.0.9.tar.gz
cd glusterfs-2.0.9
./configure

./configure命令的末尾,你应该看到这样的东西:

[...]
GlusterFS configure summary
===========================
FUSE client        : yes
Infiniband verbs   : yes
epoll IO multiplex : yes
Berkeley-DB        : yes
libglusterfsclient : yes
argp-standalone    : no

[root@server1 glusterfs-2.0.9]#
make && make install
ldconfig

之后检查GlusterFS版本(应为2.0.9):

glusterfs --version
[root@server1 glusterfs-2.0.9]# glusterfs --version
glusterfs 2.0.9 built on Mar 1 2010 15:34:50
Repository revision: v2.0.9
Copyright (c) 2006-2009 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.
[root@server1 glusterfs-2.0.9]#

接下来我们创建几个目录:

mkdir /data/
mkdir /data/export
mkdir /data/export-ns
mkdir /etc/glusterfs

现在我们创建GlusterFS服务器配置文件/etc/glusterfs/glusterfsd.vol ,它定义将导出哪个目录( / data / export )以及允许哪个客户端连接( 192.168.0.104 = client1.example.com ):

vi /etc/glusterfs/glusterfsd.vol
volume posix
  type storage/posix
  option directory /data/export
end-volume

volume locks
  type features/locks
  subvolumes posix
end-volume

volume brick
  type performance/io-threads
  option thread-count 8
  subvolumes locks
end-volume

volume server
  type protocol/server
  option transport-type tcp
  option auth.addr.brick.allow 192.168.0.104
  subvolumes brick
end-volume

请注意,可以使用通配符的IP地址(如192.168。* ),并且可以指定多个以逗号分隔的IP地址(例如192.168.0.104,192.168.0.105 )。

之后我们创建了以下符号链接...

ln -s /usr/local/sbin/glusterfsd /sbin/glusterfsd

...然后为GlusterFS服务器启动系统启动链接并启动它:

chkconfig --levels 35 glusterfsd on
/etc/init.d/glusterfsd start
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏