分类: 服务器与存储
2010-04-22 18:35:48
目录 |
介绍配置glusterfs模拟存储集群:
为每个存储服务端建立一个目录:
$ 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配置文件,使之监听不同端口。
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
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
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
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
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)
说明挂载成功!
进一步阅读