分布式文件系统glusterfs安装步骤 安装glusterfs, 步骤如下: 下面的配置文件时客户端的配置文件:

我的系统是 RHEL5 , 可能环境不一样, 需要安装的第三方依赖不一样啊, 反正大家在安装的过程中缺少什么就去安装什么, 一般都会有提示的。

下载   glusterfs-3.2.0.tar.gz  源码包。 随便解压到一个目录。

glusterfs 需要 fuse 的支持, 在安装开始之前请先安装 fuse。

fuse可以到http://fuse.sourceforge.net/进行下载

安装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 

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/

[html] view plain copy
 
  1. [root@redhat1 glusterfs]# more protocol-server.vol   
  2.   
  3. ### Export volume "brick" with the contents of "/home/export" directory.  
  4. volume brick  
  5.   type storage/posix                   # POSIX FS translator  
  6.   option directory /data/movies        # Export this directory  
  7. end-volume  
  8.   
  9. ### Add network serving capability to above brick.  
  10. volume server  
  11.   type protocol/server  
  12.   option transport-type tcp      # For TCP/IP transport  
  13.   option transport.socket.listen-port 24016                
  14.   
  15. # option transport-type ib-verbs # For Infiniband Verbs transport  
  16. # option transport.ib-verbs.work-request-send-size  131072  
  17. # option transport.ib-verbs.work-request-send-count 64  
  18. # option transport.ib-verbs.work-request-recv-size  131072  
  19. # option transport.ib-verbs.work-request-recv-count 64  
  20. # option transport.ib-verbs.listen-port 24016                
  21.   
  22. #  option bind-address 192.168.1.10     # Default is to listen on all interfaces  
  23. # option client-volume-filename /etc/glusterfs/glusterfs-client.vol  
  24.   subvolumes brick   
  25.   option auth.addr.brick.allow 192.168.* # Allow access to "brick" volume  
  26. end-volume  

上面是  服务器端 的配置文件,每台服务器的配置都一样, 共享数据目录为 /data/movies

启动服务器端的命令为  :

 glusterfsd  -l  /etc/glusterfs/g.log  -f  /etc/glusterfs/protocol-server.vol 

下面的配置文件时客户端的配置文件:

[html] view plain copy
 
  1. volume client0  
  2.   type protocol/client  
  3.   option transport-type tcp     # for TCP/IP transport  
  4. # option transport-type ib-sdp  # for Infiniband transport  
  5.   option remote-host 192.168.2.85     # IP address of the remote brick  
  6.   option transport.socket.remote-port 24016                
  7.   
  8. # option transport-type ib-verbs # for Infiniband verbs transport  
  9. # option transport.ib-verbs.work-request-send-size  1048576  
  10. # option transport.ib-verbs.work-request-send-count 16  
  11. # option transport.ib-verbs.work-request-recv-size  1048576  
  12. # option transport.ib-verbs.work-request-recv-count 16  
  13. # option transport.ib-verbs.remote-port 24016                
  14.   
  15.   option remote-subvolume brick        # name of the remote volume  
  16. # option transport-timeout 30          # default value is 120seconds   
  17. end-volume  
  18.   
  19. volume client1  
  20.   type protocol/client  
  21.   option transport-type tcp     # for TCP/IP transport  
  22. # option transport-type ib-sdp  # for Infiniband transport  
  23.   option remote-host 192.168.2.222     # IP address of the remote brick  
  24.   option transport.socket.remote-port 24016  
  25.   
  26. # option transport-type ib-verbs # for Infiniband verbs transport  
  27. # option transport.ib-verbs.work-request-send-size  1048576  
  28. # option transport.ib-verbs.work-request-send-count 16  
  29. # option transport.ib-verbs.work-request-recv-size  1048576  
  30. # option transport.ib-verbs.work-request-recv-count 16  
  31. # option transport.ib-verbs.remote-port 24016  
  32.   
  33.   option remote-subvolume brick        # name of the remote volume  
  34. # option transport-timeout 30          # default value is 120seconds  
  35. end-volume  
  36.   
  37.   
  38. volume client2  
  39.   type protocol/client  
  40.   option transport-type tcp     # for TCP/IP transport  
  41. # option transport-type ib-sdp  # for Infiniband transport  
  42.   option remote-host 192.168.2.98     # IP address of the remote brick  
  43.   option transport.socket.remote-port 24016  
  44.   
  45. # option transport-type ib-verbs # for Infiniband verbs transport  
  46. # option transport.ib-verbs.work-request-send-size  1048576  
  47. # option transport.ib-verbs.work-request-send-count 16  
  48. # option transport.ib-verbs.work-request-recv-size  1048576  
  49. # option transport.ib-verbs.work-request-recv-count 16  
  50. # option transport.ib-verbs.remote-port 24016  
  51.   
  52.   option remote-subvolume brick        # name of the remote volume  
  53. # option transport-timeout 30          # default value is 120seconds  
  54. end-volume  
  55.   
  56.   
  57. volume unify  
  58. type cluster/distribute  
  59. subvolumes client0 client1 client2  
  60. 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