Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1885222
  • 博文数量: 333
  • 博客积分: 10791
  • 博客等级: 上将
  • 技术积分: 4314
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 07:39
文章分类

全部博文(333)

文章存档

2015年(1)

2011年(116)

2010年(187)

2009年(25)

2008年(3)

2007年(1)

分类: 服务器与存储

2010-04-22 18:35:48

目录

简介

介绍配置glusterfs模拟存储集群:

  • 一个挂载点
  • 三个服务端存储节点,一个命名空间节点

配置4个服务端存储节点

为每个存储服务端建立一个目录:

$ sudo mkdir /home/cfs{0,1,2,3}
$ sudo chmod 1777 /home/cfs{0,1,2,3}
$ ls -ld /home/cfs[0-3]
drwxrwxrwt  2 root root 4096 2007-01-14 13:42 /home/cfs0
drwxrwxrwt  2 root root 4096 2007-01-14 13:42 /home/cfs1
drwxrwxrwt  2 root root 4096 2007-01-14 13:42 /home/cfs2
drwxrwxrwt  2 root root 4096 2007-01-14 13:42 /home/cfs3

然后为每个服务端编写一个vol配置文件,使之监听不同端口。

第一个存储节点: server0.vol

volume brick
        type storage/posix
        option directory /home/cfs0
end-volume
 
volume server
        type protocol/server
        option transport-type tcp/server
        option listen-port 6996
        option bind-address 127.0.0.1
        subvolumes brick
        option auth.ip.brick.allow 127.0.0.1
end-volume

第二个存储节点: server1.vol

volume brick
        type storage/posix
        option directory /home/cfs1
end-volume
 
volume server
        type protocol/server
        option transport-type tcp/server
        option listen-port 6997
        option bind-address 127.0.0.1
        subvolumes brick
        option auth.ip.brick.allow 127.0.0.1
end-volume

第三个存储节点: server2.vol

volume brick
        type storage/posix
        option directory /home/cfs2
end-volume
 
volume server
        type protocol/server
        option transport-type tcp/server
        option listen-port 6998
        option bind-address 127.0.0.1
        subvolumes brick
        option auth.ip.brick.allow 127.0.0.1
end-volume

第四个节点,命名空间节点: server3.vol

volume brick
        type storage/posix
        option directory /home/cfs3
end-volume
 
volume server
        type protocol/server
        option transport-type tcp/server
        option listen-port 6999
        option bind-address 127.0.0.1
        subvolumes brick
        option auth.ip.brick.allow 127.0.0.1
end-volume

配置客户端节点: client.vol

volume client0
 type protocol/client
 option transport-type tcp/client
 option remote-host 127.0.0.1
 option remote-port 6996
 option remote-subvolume brick
end-volume
 
volume client1
 type protocol/client
 option transport-type tcp/client
 option remote-host 127.0.0.1
 option remote-port 6997
 option remote-subvolume brick
end-volume
 
volume client2
 type protocol/client
 option transport-type tcp/client
 option remote-host 127.0.0.1
 option remote-port 6998
 option remote-subvolume brick
end-volume
 
volume ns
 type protocol/client
 option transport-type tcp/client
 option remote-host 127.0.0.1
 option remote-port 6999
 option remote-subvolume brick
end-volume
 
volume bricks
  type cluster/unify
  subvolumes client0 client1 client2
  namespace ns
  option rr.limits.min-free-disk 10GB # In later versions, its changed to % based value.
  option scheduler rr
end-volume
 
### Add writebehind feature
volume writebehind
  type performance/write-behind
  option aggregate-size 131072 # unit in bytes
  subvolumes bricks
end-volume
 
### Add readahead feature
volume readahead
  type performance/read-ahead
  option page-size 65536     # unit in bytes
  option page-count 16       # cache per file  = (page-count x page-size)
  subvolumes writebehind
end-volume

启动存储集群

启动4个服务监听各自端口,守护各自目录:

$ sudo glusterfsd -f ./server0.vol

$ sudo glusterfsd -f ./server1.vol

$ sudo glusterfsd -f ./server2.vol

$ sudo glusterfsd -f ./server3.vol

$ ps w -C glusterfsd

  PID TTY      STAT   TIME COMMAND

13524 ?        Ss     0:00 [glusterfsd]

13526 ?        Ss     0:00 [glusterfsd]

13528 ?        Ss     0:00 [glusterfsd]

13532 ?        Ss     0:00 [glusterfsd]

然后通过客户端挂载:

$ mkdir ./glusterfs

$ sudo glusterfs -f ./client.vol ./glusterfs

检查是否挂载成功:

$ mount | tail -1

glusterfs:13548 on /home/toad/gfs/glusterfs type fuse (rw,allow_other,default_permissions)

说明挂载成功!

进一步阅读

  • GlusterFS_Utility_Storage_Cluster Storage cluster is an utility I wrote to quickly set up clusters of X servers and 1 local client node. Its in Perl, and its ugly, it was not supposed to be a release of any kind.

 

阅读(1794) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~