天天看點

glusterfs初步實踐一(類似NFS)

 Glusterfs是一個具有可以擴充到幾個PB數量級的叢集檔案系統。它可以把多個不同類型的存儲塊通過Infiniband RDMA或者TCP/IP彙聚成一個大的并行網絡檔案系統。

在 http://www.gluster.org/可以了解到更多并可以下載下傳到最新的安裝包,glusterfs使用了fuse,fuse可以到 http://fuse.sourceforge.net/進行下載下傳  參考: http://anotherbug.blog.chinajavaworld.com/   一.實驗環境

目的:做個簡單的配置,類似NFS的配置

兩台伺服器IP分别為:

192.168.4.190----------------glusterfs_server

192.168.4.188----------------glusterfs_client

系統使用centos5.1,有個奇怪的問題是系統使用centos4.4的時候編譯glusterfs的時候總報錯,用centos5.1就沒事,這問題還以待研究   二.安裝

1.首先安裝fuse

tar -zxvf fuse-2.7.4.tar.gz

cd fuse-2.7.4

./configure -enable-dependency-tracking -enable-kernel-module -enable-lib -enable-util

make && make isntall 2.安裝glusterfs

tar -zxvf glusterfs-2.0.0rc1.tar.gz

cd glusterfs-2.0.0rc1

./configure

make && make install glusterfs_server和glusterfs_client端操作一樣   三. 配置

gluster_server端的操作 1.gluster_server端伺服器有一個單獨的硬碟/dev/hdb,對/dev/hdb分區并mount到/disk上,執行chmod 777 /disk

2.配置檔案的修改

mv glusterfs-server.vol.sample glusterfs-server.vol

vi /usr/local/etc/glusterfs/glusterfs-server.vol

修改後内容如下: volume brick

  type storage/posix               

  option directory /disk       

end-volume

volume server

  type protocol/server

  option transport-type tcp

# option transport-type ib-sdp

# option transport-type ib-verbs

# option transport-type unix

# option ib-verbs-work-request-send-size  131072

# option ib-verbs-work-request-send-count 64

# option ib-verbs-work-request-recv-size  131072

# option ib-verbs-work-request-recv-count 64

  option transport-type tcp/server

  option bind-address 192.168.4.190   

  option listen-port 6996          

# option client-volume-filename /etc/glusterfs/glusterfs-client.vol

  subvolumes brick

  option auth.addr.brick.allow *

  end-volume glusterfs_client的配置

mv glusterfs-client.vol.sample glusterfs-client.vol

vi /usr/local/etc/glusterfs/glusterfs-client.vol

修改後内容如下: volume client

  type protocol/client

  option transport-type tcp

# option transport-type unix

# option transport-type ib-sdp

# option transport-type ib-verbs

# option ib-verbs-work-request-send-size  1048576

# option ib-verbs-work-request-send-count 16

# option ib-verbs-work-request-recv-size  1048576

# option ib-verbs-work-request-recv-count 16

option remote-host 192.168.4.190       

option remote-port 6996            

# option transport-timeout 30

option remote-subvolume brick       

end-volume   四. 操作

glusterfs_server端的操作

1.glusterfsd -f /usr/local/etc/glusterfs/glusterfs-server.vol  啟動server端

2.ps -ef | grep glusterfs                                      檢視程序存在不存在

3.netstat -ln | grep 6996                                      檢視端口是否監聽   glusterfs_client端的操作

1.modprobe -i fuse                加載fuse子產品

2.glusterfs -l /tmp/glusterfs.log -f /usr/local/etc/glusterfs/glusterfs-client.vol /mnt      挂載到/mnt上,同時可以檢視 /tmp下的glusterfs.log日志

3.[[email protected]_client]# df -h

檔案系統              容量  已用 可用 已用% 挂載點

/dev/hda1             8.5G  5.0G  3.2G  62% /

tmpfs                 125M     0  125M   0% /dev/shm

glusterfs             6.0G  147M  5.5G   3% /mnt

可以在/mnt下進行touch指令建立檔案測試

                                                                                                      by:jialisong

                                                                                                                         2009-06-24    

轉載于:https://blog.51cto.com/jlsfwq/169540

繼續閱讀