分布式存储在四个存储节点与GlusterFS在Debian Lenny

本教程将介绍如何使用GlusterFS将四个单一存储服务器(运行Debian Lenny)组合到一个大型存储服务器(分布式存储)。 客户端系统(Debian Lenny)也将能够访问存储,就像它是本地文件系统一样。 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
127.0.0.1       localhost.localdomain   localhost
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

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

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

2设置GlusterFS服务器

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

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

aptitude install sshfs build-essential flex bison byacc libdb4.6 libdb4.6-dev

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

cd /tmp
wget http://ftp.gluster.com/pub/gluster/glusterfs/2.0/LATEST/glusterfs-2.0.1.tar.gz
tar xvfz glusterfs-2.0.1.tar.gz
cd glusterfs-2.0.1
./configure --prefix=/usr > /dev/null
server1:/tmp/glusterfs-2.0.1# ./configure --prefix=/usr > /dev/null

GlusterFS configure summary
===========================
FUSE client        : no
Infiniband verbs   : no
epoll IO multiplex : yes
Berkeley-DB        : yes
libglusterfsclient : yes
mod_glusterfs      : no ()
argp-standalone    : no

server1:/tmp/glusterfs-2.0.1#
make && make install
ldconfig

命令

glusterfs --version

现在应该显示您刚刚编译的GlusterFS版本(在这种情况下为2.0.1):

server1:/tmp/glusterfs-2.0.1# glusterfs --version
glusterfs 2.0.1 built on May 29 2009 17:23:10
Repository revision: 5c1d9108c1529a1155963cb1911f8870a674ab5b
Copyright (c) 2006-2009 Z RESEARCH Inc. <http://www.zresearch.com>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GlusterFS under the terms of the GNU General Public License.
server1:/tmp/glusterfs-2.0.1#

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

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 )。

之后,我们为glusterfsd init脚本创建系统启动链接...

update-rc.d glusterfsd defaults

...并启动glusterfsd

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

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

支付宝扫一扫打赏

微信扫一扫打赏