如何在 BladeCenter JS20 上安装 PVFS2 文件系统

来源:百度文库 编辑:神马文学网 时间:2024/04/26 05:28:12
适用机型:
所有BladeCenter JS20
文档内容:
近些年来,越来越多的应用程序对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.pvfs.org/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.pvfs.org/pvfs2/download.html
PVFS2 的 FAQ 以及 QuickGuide
http://www.pvfs.org/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