我的系统是 RHEL5 , 可能环境不一样, 需要安装的第三方依赖不一样啊, 反正大家在安装的过程中缺少什么就去安装什么, 一般都会有提示的。
下载 glusterfs-3.2.0.tar.gz 源码包。 随便解压到一个目录。
glusterfs 需要 fuse 的支持, 在安装开始之前请先安装 fuse。
安装fuse的步骤如下:
./configure
make
make install
glusterfs 需要 ctypes 的支持, 在安装开始之前请先安装 ctypes。
ctypes看的下载地址为 http://python.net/crew/theller/ctypes/
ctypes库安装时需要使用 python,安装步骤如下
python setup.py build
python setup.py test
python setup.py install
安装glusterfs, 步骤如下:
cd /home/glusterfs-3.2.0
./configure --enable-fusermount
make
make install
下来需要进行配置,我这里的环境为 :
server端3台----------- 192.168.2.85 和 192.168.2.222 和 192.168.2.98
client 端1台------------192.168.2.55
配置文件所在的目录为 /etc/glusterfs/
- [root@redhat1 glusterfs]# more protocol-server.vol
-
- ### Export volume "brick" with the contents of "/home/export" directory.
- volume brick
- type storage/posix # POSIX FS translator
- option directory /data/movies # Export this directory
- end-volume
-
- ### Add network serving capability to above brick.
- volume server
- type protocol/server
- option transport-type tcp # For TCP/IP transport
- option transport.socket.listen-port 24016
-
- # option transport-type ib-verbs # For Infiniband Verbs transport
- # option transport.ib-verbs.work-request-send-size 131072
- # option transport.ib-verbs.work-request-send-count 64
- # option transport.ib-verbs.work-request-recv-size 131072
- # option transport.ib-verbs.work-request-recv-count 64
- # option transport.ib-verbs.listen-port 24016
-
- # option bind-address 192.168.1.10 # Default is to listen on all interfaces
- # option client-volume-filename /etc/glusterfs/glusterfs-client.vol
- subvolumes brick
- option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume
- end-volume
上面是 服务器端 的配置文件,每台服务器的配置都一样, 共享数据目录为 /data/movies
启动服务器端的命令为 :
glusterfsd -l /etc/glusterfs/g.log -f /etc/glusterfs/protocol-server.vol
下面的配置文件时客户端的配置文件:
- volume client0
- type protocol/client
- option transport-type tcp # for TCP/IP transport
- # option transport-type ib-sdp # for Infiniband transport
- option remote-host 192.168.2.85 # IP address of the remote brick
- option transport.socket.remote-port 24016
-
- # option transport-type ib-verbs # for Infiniband verbs transport
- # option transport.ib-verbs.work-request-send-size 1048576
- # option transport.ib-verbs.work-request-send-count 16
- # option transport.ib-verbs.work-request-recv-size 1048576
- # option transport.ib-verbs.work-request-recv-count 16
- # option transport.ib-verbs.remote-port 24016
-
- option remote-subvolume brick # name of the remote volume
- # option transport-timeout 30 # default value is 120seconds
- end-volume
-
- volume client1
- type protocol/client
- option transport-type tcp # for TCP/IP transport
- # option transport-type ib-sdp # for Infiniband transport
- option remote-host 192.168.2.222 # IP address of the remote brick
- option transport.socket.remote-port 24016
-
- # option transport-type ib-verbs # for Infiniband verbs transport
- # option transport.ib-verbs.work-request-send-size 1048576
- # option transport.ib-verbs.work-request-send-count 16
- # option transport.ib-verbs.work-request-recv-size 1048576
- # option transport.ib-verbs.work-request-recv-count 16
- # option transport.ib-verbs.remote-port 24016
-
- option remote-subvolume brick # name of the remote volume
- # option transport-timeout 30 # default value is 120seconds
- end-volume
-
-
- volume client2
- type protocol/client
- option transport-type tcp # for TCP/IP transport
- # option transport-type ib-sdp # for Infiniband transport
- option remote-host 192.168.2.98 # IP address of the remote brick
- option transport.socket.remote-port 24016
-
- # option transport-type ib-verbs # for Infiniband verbs transport
- # option transport.ib-verbs.work-request-send-size 1048576
- # option transport.ib-verbs.work-request-send-count 16
- # option transport.ib-verbs.work-request-recv-size 1048576
- # option transport.ib-verbs.work-request-recv-count 16
- # option transport.ib-verbs.remote-port 24016
-
- option remote-subvolume brick # name of the remote volume
- # option transport-timeout 30 # default value is 120seconds
- end-volume
-
-
- volume unify
- type cluster/distribute
- subvolumes client0 client1 client2
- end-volume
启动客户端的命令为:
glusterfs -l /etc/glusterfs/glusterfs.log -f /etc/glusterfs/protocol-client.vol /mnt
启动后可以检查 /etc/glusterfs/glusterfs.log 文件, 进行查看日志。
也可以用 df -h 命令来查看,如下代表成功
glusterfs#/etc/glusterfs/protocol-client.vol
654G 133G 487G 22% /mnt
由于glusterfs 使用了 fuse, 所以就和使用本地的一个目录一样使用这个分布式的文件系统了。
不信你就执行一下 :
ls /mnt
cp /etc/glusterfs/protocol-client.vol /mnt
ls /mnt
祝大家工作愉快 !
在配置的过程中如果有什么问题, 大家还可以参考
http://hi.baidu.com/farmerluo/blog/category/Glusterfs
介绍的还是蛮详细的。
转自:http://blog.csdn.net/langeldep/article/details/6587207