如何在 BladeCenter JS20 上安裝 PVFS2 文件系統
近些年來,越來越多的應用程序對IO的性能提出了更高的要求,特別是針對一些大數據集的應用程序,針對這種情況,常見的一種方法就是通過并行的方式來提高IO的性能。 PVFS 是并行虛擬文件系統 Parallel Virtual File System 的縮寫。這是一種開放的文件系統,這種文件系統就好象陣列的條帶化一樣,使用高速連接的多臺機器上的硬盤空間,組成一個虛擬的文件系統。如果通訊網絡足夠快的話,它的性能會大大高于本地的存儲。而 PVFS2 是基于 PVFS 開發的,支持Linux 2.6 的內核,并做了其它的一些改進。 目前在國內,我們經常會聽到很多客戶用多臺服務器組建出一個高性能計算的集群,其中有很多應用程序都是IO密集型的應用,在這種情況下,就需要采用PVFS2或者GPFS這樣的并行文件系統。 通常,PVFS2可以運行在基于Intel的Linux 操作系統下,但是,得益于開放源碼的特點,我們可以很容易的把PVFS2移植到Power架構下。下面我們就用幾個IBM BladeCenter JS20的刀片服務器來實驗一下PVFS2文件系統的安裝及設置。
PVFS2 對軟件包的要求:
db-devel kernel-source db-64bit (生成64位的PVFS2 Client 時需要)
測試環境:
在這里,我們使用的是PVFS2 1.3.0 的版本,可以從下面網址去下載 http://www./pvfs2/index.html
BladeCenter JS20 三臺,在本次實驗中,我們用兩臺 BladeCenter JS20 來做為 PVFS2 Data I/O Server (node17, node18),而 node17 同時也是 PVFS2 MetaData Server. 另外一臺 BladeCenter 我們做為 PVFS2 Client node17 (192.168.28.57) node18 (192.168.28.58) test01 (192.168.28.60)
操作系統我們使用的是 SuSE Linux Enterprise Server 9
PVFS2 Server 的安裝:
(我們把下載的 pvfs2-1.3.0.tar.gz 放在了 /tmp 目錄下) 首先我們要進行解包: node17:/tmp # tar xzvf pvfs2-1.3.0.tar.gz 然后進行設置: node17:/tmp # cd pvfs2-1.3.0/ node17:/tmp/pvfs2-1.3.0 # ./configure 最后會出現下面的顯示信息: ***** Displaying PVFS2 Configuration Information ***** ------------------------------------------------------ PVFS2 configured to build karma gui : no PVFS2 configured to use epoll : no PVFS2 configured to perform coverage analysis : no PVFS2 configured for aio threaded callbacks : yes PVFS2 configured for the 2.6.x kernel module : no PVFS2 configured for the 2.4.x kernel module : no PVFS2 configured for using the mmap-ra-cache : no PVFS2 configured for a thread-safe client library : yes PVFS2 will use workaround for redhat 2.4 kernels : no PVFS2 will use workaround for buggy NPTL : no PVFS2 server will be built : yes PVFS2 version string: 1.3.0
生成二進制文件: node17:/tmp/pvfs2-1.3.0 # make
安裝生成的二進制文件: node17:/tmp/pvfs2-1.3.0 # make install
同樣的操作,我們要在另一個裝備做為PVFS2 I/O Server 的 node18 上再做一遍。
PVFS2 Client 的安裝:
在準備做為 PVFS2 Client 的 test01 上,我們要生成 64 位的應用程序,這是由于我們使用的Linux內核是64位的,PVFS2 Client 必須與內核匹配。 (我們把下載的 pvfs2-1.3.0.tar.gz 放在了 /tmp 目錄下) 解開壓縮包: test02:/tmp # tar xzvf pvfs2-1.3.0.tar.gz test02:/tmp # cd pvfs2-1.3.0/ 編譯前,先定義兩個環境變量,這樣,在生成二進制文件中,就會生成64位的程序: test02:/tmp/pvfs2-1.3.0 # export CFLAGS=”-m64” test02:/tmp/pvfs2-1.3.0 # export LDFLAGS=”-m64” 生成二進制文件(使用 --disable-server 選項會在編譯時,不成生PVFS2 Server 的相關程序): test02:/tmp/pvfs2-1.3.0 # ./configure --with-kernel=/usr/src/linux –disable-server
***** Displaying PVFS2 Configuration Information ***** ------------------------------------------------------ PVFS2 configured to build karma gui : no PVFS2 configured to use epoll : no PVFS2 configured to perform coverage analysis : no PVFS2 configured for aio threaded callbacks : yes PVFS2 configured for the 2.6.x kernel module : yes PVFS2 configured for the 2.4.x kernel module : no PVFS2 configured for using the mmap-ra-cache : no PVFS2 configured for a thread-safe client library : yes PVFS2 will use workaround for redhat 2.4 kernels : no PVFS2 will use workaround for buggy NPTL : no PVFS2 server will be built : no
PVFS2 version string: 1.3.0
生成二進制文件: node17:/tmp/pvfs2-1.3.0 # make
安裝生成的二進制文件: node17:/tmp/pvfs2-1.3.0 # make install
準備生成 kernel module: test02:/tmp/pvfs2-1.3.0 # make kmod
安裝生成的 kernel module: test02:/tmp/pvfs2-1.3.0 # make kmod_install
運行 PVFS
設置 PVFS Server: 在 node17 上,運行下面命令: node17:/tmp/pvfs2-1.3.0 # pvfs2-genconfig /etc/pvfs2-fs.conf /etc/pvfs2-server.conf · Protocol: tcp · Port: 3334 · I/O Servers: 所有準備提供存儲空間的服務器 · Metadata Server: 做為Metadata 的服務器 · Logfile: /var/log/pvfs2.log · Data store directory: /pvfs-storage 初始化做為 pvfs2 的存儲空間: 在 node17 和 node18 上,都要執行,缺省情況下,會是 /pvfs2-storage-space,可以通過修改 /etc/pvfs2-server.conf-* 的文件來更改。 node17 上 node17:/tmp/pvfs2-1.3.0 # pvfs2-server /etc/pvfs2-fs.conf /etc/pvfs2-server.conf-node17 –f node18 上 node18:/tmp/pvfs2-1.3.0 # pvfs2-server /etc/pvfs2-fs.conf /etc/pvfs2-server.conf-node18 -f
啟動 pvfs2 server: node17 上 node17:/tmp/pvfs2-1.3.0 # pvfs2-server /etc/pvfs2-fs.conf /etc/pvfs2-server.conf-node17 [22:38:42.560848] PVFS2 Server version 1.3.0 starting. node18 上 node18:/tmp/pvfs2-1.3.0 # pvfs2-server /etc/pvfs2-fs.conf /etc/pvfs2-server.conf-node18 [22:38:42.560848] PVFS2 Server version 1.3.0 starting.
設置 PVFS2 Client: test02:/tmp/pvfs2-1.3.0 # mkdir /mnt/pvfs2
test02:/tmp/pvfs2-1.3.0 # vi /etc/pvfs2tab 加入一行 tcp://node17:3334/pvfs2-fs /mnt/pvfs2 pvfs2 defaults 0 0
測試 pvfs2: test02:/tmp/pvfs2-1.3.0 # pvfs2-ping -m /mnt/pvfs2/
(1) Parsing tab file...
(2) Initializing system interface...
(3) Initializing each file system found in tab file: /etc/pvfs2tab...
/mnt/pvfs2: Ok
(4) Searching for /mnt/pvfs2/ in pvfstab...
PVFS2 servers: tcp://node17:3334 Storage name: pvfs2-fs Local mount point: /mnt/pvfs2
meta servers: tcp://node17:3334
data servers: tcp://node17:3334 tcp://node18:3334
(5) Verifying that all servers are responding...
meta servers: tcp://node17:3334 Ok
data servers: tcp://node17:3334 Ok tcp://node18:3334 Ok
(6) Verifying that fsid 1106969663 is acceptable to all servers...
Ok; all servers understand fs_id 1106969663
(7) Verifying that root handle is owned by one server...
Root handle: 1048576 Ok; root handle is owned by exactly one server.
=============================================================
The PVFS filesystem at /mnt/pvfs2/ appears to be correctly configured.
我們可以先嘗試向 pvfs2 文件系統上寫一個文件 test02:/tmp/pvfs2-1.3.0 # pvfs2-ls /mnt/pvfs2 lost+found
我們用dd創建一個100MB的用來測試的文件 testfile test02:/tmp/pvfs2-1.3.0 # dd if=/dev/zero of=/tmp/testfile bs=1024 count=102400 102400+0 records in 102400+0 records out
把 testfile 拷貝到PVFS2文件系統上 test02:/tmp/pvfs2-1.3.0 # pvfs2-cp /tmp/testfile /mnt/pvfs2
檢查一下剛才拷貝的文件是否存大,文件大小是否一致 test02:/tmp/pvfs2-1.3.0 # pvfs2-ls -lh /mnt/pvfs2 drwxrwxrwx 1 root root 4.0K 2005-09-21 22:48 lost+found -rw-r--r-- 1 root root 100.0M 2005-09-21 14:44 testfile
刪除剛才拷貝的文件 testfile test02:/tmp/pvfs2-1.3.0 # pvfs2-rm /mnt/pvfs2/testfile test02:/tmp/pvfs2-1.3.0 # pvfs2-ls /mnt/pvfs2 lost+found
上面,我們是使用PVFS提供的工具來對PVFS2文件系統來訪問,如果要在操作系統下,象訪問本地硬盤一樣直接訪問PVFS2文件系統,我們需要先加載 pvfs2 文件系統到 /mnt/pvfs2,這樣我們就可以用正常的方式來訪問 pvfs2 文件系統了。
首先要加載 pvfs2.ko 模塊: test02:/tmp/pvfs2-1.3.0 # depmod test02:/tmp/pvfs2-1.3.0 # modprobe pvfs2 (在剛才執行了 make kmod_install 以后,pvfs2.ko 會被安裝到 /lib/modules/2.6.5-7.97-pseries64/kernel/fs/pvfs2 目錄下)
啟動 pvfs2 client: test02:/tmp/pvfs2-1.3.0 # pvfs2-client –p /usr/local/sbin/pvfs2-client-core (一定要先加裁 pvfs2.ko 的模塊,再啟動 pvfs2 client 程序)
加載 pvfs2 文件系統 mount –t pvfs2 tcp://node17:3334/pvfs2-fs /mnt/pvfs2
現在,我們就可以用系統命令來訪問 pvfs2 文件系統了: test02:/tmp/pvfs2-1.3.0 # ls /mnt/pvfs2/ . .. lost+found test02:/tmp/pvfs2-1.3.0 # cp /tmp/testfile /mnt/pvfs2/ test02:/tmp/pvfs2-1.3.0 # ll -h /mnt/pvfs2/ total 101M drwxrwxrwx 2 root root 4.0K Oct 21 14:52 . drwxr-xr-x 3 root root 72 Oct 20 17:08 .. drwxrwxrwx 1 root root 4.0K Oct 21 2005 lost+found -rw-r--r-- 1 root root 100M Oct 21 14:52 testfile test02:/tmp/pvfs2-1.3.0 # rm /mnt/pvfs2/testfile test02:/tmp/pvfs2-1.3.0 # ls /mnt/pvfs2/ . .. lost+found
注: 下載 PVFS2 的網址 http://www./pvfs2/download.html PVFS2 的 FAQ 以及 QuickGuide http://www./pvfs2/documentation.html
讓系統啟動時,pvfs2 server 做為一個服務自動啟動: 把下面的文件拷貝到 /etc/init.d 目錄下,并且用 chmod 改為可執行
(此文件是根據 example/pvfs2-server.rc 改的,因為 pvfs2-server.rc 是針對 Red Hat 的腳本) 執行命令 test02:/tmp/pvfs2-1.3.0 # chkconfig –a pvfs2-server test02:/tmp/pvfs2-1.3.0 # ln –s /etc/init.d/pvfs2-server /usr/sbin/rcpvfs2-server
|