glusterfs是基于fuse设计的文件系统,与其它文件系统有两个最终要的不同之处:
1)用户层的文件系统,开发简单,稳定性好(不会搞死内核);
2)层次式的调用,组件形式的开发;
因为对glusterfs的学习还在初级阶段,因此从头开始写起!
1。安装
可以使用源码安装,先安装fuse,再安装glusterfs;
安装fuse
./configure;
make install;
modprobe fuse;
安装glusterfs:
sh autogen.sh
./configure --disable bdb(要不要那个自己选,可以用./configure --help看)
make install
2. 写vol
server.vol
volume brick
type storage/posix
option directory /export
end-volume
volume server
type protocol/server
subvolumes colon-o
option transport-type tcp
option auth.addr.brick.allow *
end-volume
client.vol
volume client1
type protocol/client
option transport-type tcp
option remote-host 192.168.1.1 //sever address
option remote-subvolume brick
end-volume
volume client2
type protocol/client
option transport-type tcp
option remote-host 192.168.1.2 //sever address
option remote-subvolume brick
end-volume
volume distribute
type cluster/distribute
subvolumes client1 client2
end-volume
3.启动服务
server端服务:glusterfsd -f $GLUSTERFSPATH/server.vol
客户端挂载:glusterfs -f $GLUSTERFSPATH/client.vol /mnt/glusterfs
启动客户端后就可以使用glusterfs文件系统了,客户端所写的文件会被放置到这两个server上,放置的原则是按照文件名hash。