1.配置环境 (root用户)
(1) 在两台机器上分别配置/etc/hosts
202.117.10.37 www.linuxidc.com
202.117.10.50 www.linuxidc.net
(2) 配置无密码登录(在www.linuxidc.com上)
[root@www.linuxidc.com ~]# ssh-keygen -t rsa
[root@www.linuxidc.com ~]# cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
[root@www.linuxidc.com ~]# scp ~/.ssh/* root@www.linuxidc.net:~/.ssh/
(3) 机器角色分配
www.linuxidc.com作为metadata server
www.linuxidc.com和www.linuxidc.net同时作为I/O server
www.linuxidc.com和www.linuxidc.net同时作为client
2. 安装pvfs-2.8.2 (root用户在www.linuxidc.com和www.linuxidc.net上分配编译安装)
(0)预备
在/root下创建 program/pvfs2-install目录,作为安装目录
soft目录(放置pvfs-2.8.2.tar.gz)
(1) 解压
[root@www.linuxidc.com soft]# tar -zxvf pvfs-2.8.2.tar.gz
(2) 编译安装
[root@www.linuxidc.com pvfs-2.8.2]# ./configure -prefix=/root/program/pvfs2-install/
[root@www.linuxidc.com pvfs-2.8.2]# make
[root@www.linuxidc.com pvfs-2.8.2]# make install
3. 服务器端配置
(1)www.linuxidc.com作metadata server,www.linuxidc.com和www.linuxidc.net作I/O节点
(2) 在www.linuxidc.com上生成配置文件
[root@www.linuxidc.com ~]# ~/program/pvfs2-install/bin/pvfs2-genconfig /etc/pvfs2-fs.conf
- **********************************************************************
- Welcome to the PVFS2 Configuration Generator:
- This interactive script will generate configuration files suitable
- for use with a new PVFS2 file system. Please see the PVFS2 quickstart
- guide for details.
- **********************************************************************
- You must first select the network protocol that your file system will use.
- The only currently supported options are "tcp", "gm", "mx", "ib", and "portals".
- (For multi-homed configurations, use e.g. "ib,tcp".)
- * Enter protocol type [Default is tcp]:
- Choose a TCP/IP port for the servers to listen on. Note that this
- script assumes that all servers will use the same port number.
- * Enter port number [Default is 3334]:
- Choose a directory for each server to store data in.
- * Enter directory name: [Default is /pvfs2-storage-space]:
- Choose a file for each server to write log messages to.
- * Enter log file location [Default is /tmp/pvfs2-server.log]:
- Next you must list the hostnames of the machines that will act as
- <span style="color:#ff0000;">I/O servers</span>. Acceptable syntax is "node1, node2, ..." or "node{#-#,#,#}".
- * Enter hostnames [Default is localhost]: <span style="color:#ff0000;">amao99{1-2}
- </span>Use same servers for metadata? (recommended)
- * Enter yes or no [Default is yes]: <span style="color:#ff0000;">no</span>
- Now list the hostnames of the machines that will act as <span style="color:#ff0000;">Metadata
- servers</span>. This list may or may not overlap with the I/O server list.
- * Enter hostnames [Default is localhost]: <span style="color:#ff0000;">www.linuxidc.com</span>
- Configured a total of 2 servers:
- 2 of them are I/O servers.
- 1 of them are Metadata servers.
- * Would you like to verify server list (y/n) [Default is n]? y
- ****** I/O servers:
- www.linuxidc.com
- www.linuxidc.net
- ****** Metadata servers:
- www.linuxidc.com
- * Does this look ok (y/n) [Default is y]? y
- Writing fs config file... done
(3)把配置文件从www.linuxidc.com上拷贝到www.linuxidc.net上,放在相同的路径下
[root@www.linuxidc.com ~]# scp /etc/pvfs2-fs.conf www.linuxidc.net:/etc/
(4)在www.linuxidc.com和www.linuxidc.net上分别设置服务,并开机启动
[root@www.linuxidc.com ~]# cp ~/soft/pvfs-2.8.2/examples/pvfs2-server.rc /etc/rc.d/init.d/pvfs2-server
[root@www.linuxidc.com ~]# chmod a+x /etc/rc.d/init.d/pvfs2-server
[root@www.linuxidc.com ~]# chkconfig pvfs2-server on
在www.linuxidc.net上的执行同上,也可以在www.linuxidc.com上对www.linuxidc.net执行操作,如下:
[root@www.linuxidc.com ~]# scp ~/soft/pvfs-2.8.2/examples/pvfs2-server.rc www.linuxidc.net:/etc/rc.d/init.d/pvfs2-server
[root@www.linuxidc.com ~]# ssh www.linuxidc.net /bin/chmod a+x /etc/rc.d/init.d/pvfs2-server
[root@www.linuxidc.com ~]# ssh www.linuxidc.net /sbin/chkconfig pvfs2-server on
(5)创建存储空间(分别在两个IO Server上)
[root@www.linuxidc.com ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf -f
[root@www.linuxidc.com ~]# ll / 会发现多了/pvfs2-storage-space
同样在www.linuxidc.net上执行
[root@www.linuxidc.net ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf -f
[root@www.linuxidc.net ~]# ll / 会发现多了/pvfs2-storage-space
(6) 手动启动metadata server和I/O server(即就是在www.linuxidc.com和www.linuxidc.net上执行)
[root@www.linuxidc.net ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf
[S 12/23 18:09] PVFS2 Server on node www.linuxidc.net version 2.8.2 starting...
可以用netstat -nplt查看该服务已经启动了,占用3344端口
同样在www.linuxidc.net上执行
[root@www.linuxidc.net ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf
4. 客户端配置
也www.linuxidc.com作client为例(任何其他机器都可以作client),创建挂在点,并设置开机挂在文件pvfs2tab
[root@www.linuxidc.com ~]# mkdir /mnt/pvfs2
[root@www.linuxidc.com ~]# touch /etc/pvfs2tab
[root@www.linuxidc.com ~]# chmod a+r /etc/pvfs2tab
[root@www.linuxidc.com ~]# vi /etc/pvfs2tab
[root@www.linuxidc.com ~]# cat /etc/pvfs2tab
tcp://www.linuxidc.net:3334/pvfs2-fs /mnt/pvfs2 pvfs2 defaults,noauto 0 0 #noauto on mount -a
说明:
(1)其实把上面这一行放入/etc/fstab也是可以的,就没必要创建/etc/pvfs2tab文件了
(2)本例子中存储节点有两个www.linuxidc.com和www.linuxidc.net,当client端挂在server时,因为server是平等身份的,所以,随便挂在哪一个都可以,本例子中挂在了tcp://www.linuxidc.net:3334/pvfs2-fs
(3)当有多个client时,不同的Client尽量不挂在同一个server,这样做可以分散input/output负载
(4)设置完成后,重启client,就会自动mount了,然后就可以测试了
