Redhat5.4安装pvfs-2.8.2全过程(集群)

本文详细介绍了如何在两台机器上配置和部署PVFS2分布式文件系统,包括环境配置、无密码登录设置、软件编译安装及服务器端与客户端配置等步骤。

1.配置环境   (root用户)

(1) 在两台机器上分别配置/etc/hosts

202.117.10.37   amao991   

202.117.10.50   amao992  

(2) 配置无密码登录(在amao991上)

[root@amao991 ~]# ssh-keygen -t rsa 

[root@amao991 ~]# cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

[root@amao991 ~]# scp ~/.ssh/*  root@amao992:~/.ssh/

(3) 机器角色分配

amao991作为metadata server

amao991和amao992同时作为I/O server

amao991和amao992同时作为client

2. 安装pvfs-2.8.2 (root用户在amao991和amao992上分配编译安装)

(0)预备

在/root下创建 program/pvfs2-install目录,作为安装目录

soft目录(放置pvfs-2.8.2.tar.gz)

(1) 解压

[root@amao991 soft]# tar -zxvf pvfs-2.8.2.tar.gz

(2) 编译安装

[root@amao991 pvfs-2.8.2]# ./configure -prefix=/root/program/pvfs2-install/   

-with-kernel=/usr/src/kernels/2.6.18-164.el5-i686/ 

-with-mpi=/root/program/mpich2-install/


[root@amao991 pvfs-2.8.2]# make

[root@amao991 pvfs-2.8.2]# make install

3. 服务器端配置

(1)amao991作metadata server,amao991和amao992作I/O节点

(2) 在amao991上生成配置文件

[root@amao991 ~]# ~/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
I/O servers.  Acceptable syntax is "node1, node2, ..." or "node{#-#,#,#}".

* Enter hostnames [Default is localhost]: node15, node16

Use same servers for metadata? (recommended)

* Enter yes or no [Default is yes]: no

Now list the hostnames of the machines that will act as Metadata
servers.  This list may or may not overlap with the I/O server list.

* Enter hostnames [Default is localhost]: node15

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:
node15
node16

****** Metadata servers:
node15

* Does this look ok (y/n) [Default is y]? y

Writing fs config file... done

(3)把配置文件从amao991上拷贝到amao992上,放在相同的路径下

[root@amao991 ~]# scp /etc/pvfs2-fs.conf amao992:/etc/

(4)在amao991和amao992上分别设置服务,并开机启动

[root@amao991 ~]# cp ~/soft/pvfs-2.8.2/examples/pvfs2-server.rc /etc/rc.d/init.d/pvfs2-server

[root@amao991 ~]# chmod a+x /etc/rc.d/init.d/pvfs2-server

[root@amao991 ~]# chkconfig pvfs2-server on

在amao992上的执行同上,也可以在amao991上对amao992执行操作,如下:

[root@amao991 ~]# scp ~/soft/pvfs-2.8.2/examples/pvfs2-server.rc amao992:/etc/rc.d/init.d/pvfs2-server

[root@amao991 ~]# ssh amao992 /bin/chmod a+x /etc/rc.d/init.d/pvfs2-server

[root@amao991 ~]# ssh amao992 /sbin/chkconfig pvfs2-server on

(5)创建存储空间(分别在两个IO Server上)

[root@amao991 ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf -f

[root@amao991 ~]# ll /   会发现多了/pvfs2-storage-space

同样在amao992上执行

[root@amao992 ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf -f

[root@amao992 ~]# ll /    会发现多了/pvfs2-storage-space

(6) 手动启动metadata server和I/O server(即就是在amao991和amao992上执行)

[root@amao992 ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf
[S 12/23 18:09] PVFS2 Server on node amao992 version 2.8.2 starting...

可以用netstat -nplt查看该服务已经启动了,占用3334端口

同样在amao992上执行

[root@amao992 ~]# ~/program/pvfs2-install/sbin/pvfs2-server /etc/pvfs2-fs.conf 

4. 客户端配置

也amao991作client为例(任何其他机器都可以作client),创建挂在点,并设置开机挂在文件pvfs2tab

[root@amao991 ~]# mkdir /mnt/pvfs2

[root@amao991 ~]# touch /etc/pvfs2tab

[root@amao991 ~]# chmod a+r /etc/pvfs2tab

[root@amao991 ~]# vi /etc/pvfs2tab

[root@amao991 ~]# cat /etc/pvfs2tab

tcp://amao992:3334/pvfs2-fs /mnt/pvfs2 pvfs2 defaults,noauto 0 0  #noauto on mount -a

说明:

(1)其实把上面这一行放入/etc/fstab也是可以的,就没必要创建/etc/pvfs2tab文件了

(2)本例子中存储节点有两个amao991和amao992,当client端挂在server时,因为server是平等身份的,所以,随便挂在哪一个都可以,本例子中挂在了tcp://amao992:3334/pvfs2-fs

(3)当有多个client时,不同的Client尽量不挂在同一个server,这样做可以分散input/output负载

(4)设置完成后,重启client,就会自动mount了,然后就可以测试了

5. 测试(在client端测试借助pvfs2-ping, pvfs-cp, pvfs-ls命令来测试)

[root@amao991 ~]# ~/program/pvfs2-install/bin/pvfs2-ping -m /mnt/pvfs2/

(1) Parsing tab file...

(2) Initializing system interface...

(3) Initializing each file system found in tab file: /etc/pvfs2tab...

   PVFS2 servers: tcp://amao992:3334
   Storage name: pvfs2-fs
   Local mount point: /mnt/pvfs2
   /mnt/pvfs2: Ok

(4) Searching for /mnt/pvfs2/ in pvfstab...

   PVFS2 servers: tcp://amao992:3334
   Storage name: pvfs2-fs
   Local mount point: /mnt/pvfs2

   meta servers:
   tcp://amao991:3334

   data servers:
   tcp://amao991:3334
   tcp://amao992:3334

(5) Verifying that all servers are responding...

   meta servers:
   tcp://amao991:3334 Ok

   data servers:
   tcp://amao991:3334 Ok
   tcp://amao992:3334 Ok

(6) Verifying that fsid 1249973606 is acceptable to all servers...

   Ok; all servers understand fs_id 1249973606

(7) Verifying that root handle is owned by one server...

   Root handle: 1048576
     Ok; root handle is owned by exactly one server.

=============================================================

The PVFS2 filesystem at /mnt/pvfs2/ appears to be correctly configured.

[root@amao991 ~]# ~/program/pvfs2-install/bin/pvfs2-ls /mnt/pvfs2    
lost+found  //第一次ls,没任何东西


[root@amao991 ~]# ~/program/pvfs2-install/bin/pvfs2-cp -t /usr/lib/libc.a /mnt/pvfs2/testfile
Wrote 2817820 bytes in 1.041003 seconds. 2.581436 MB/seconds     //cp了一些东西放进去
[root@amao991 ~]# ~/program/pvfs2-install/bin/pvfs2-ls -alh /mnt/pvfs2  
drwxrwxrwx    1 root     root            4.0K 2011-12-23 18:37 .       //果真有东西了
drwxrwxrwx    1 root     root            4.0K 2011-12-23 18:37 .. (faked)
-rw-r--r--    1 root     root            2.7M 2011-12-23 18:37 testfile
drwxrwxrwx    1 root     root            4.0K 2011-12-23 18:06 lost+found


[root@amao991 /]# ~/program/pvfs2-install/bin/pvfs2-cp -t /mnt/pvfs2/testfile /tmp/testfile-out
Wrote 2817820 bytes in 0.157310 seconds. 17.082721 MB/seconds  //把放进去的东西再拷出来,放在/tmp下面


[root@amao991 /]# diff /tmp/testfile-out /usr/lib/libc.a   //把考出来的文件和原来的文件比较,发现一模一样

6.总结

(1)client把I/O servers(不管I/O server有多少个节点)之一挂在到本地/mnt/pvfs2目录后,就可以像访问本地目录一样对其进行读/写/操作了

(2)唯一不同的是,不是用linux自带的读写命令(如ls, cp),而要用到pvfs2的命令(pvfs2-ls, pvfs2-cp),故在client上也应该把这些命令文件放置好

(3)为了在client上执行命令时,不用绝对路径或者相对路径,可以把防止pvfs2命令的目录加入到环境变量文件中

(4)通过client给/mnt/pvfs2写入一些文件后,分别在amao991和amao992两个节点上通过linux自带的ll查看本地存储目录/pvfs2-storage-space/

du /pvfs2-storage-space/6b24f650/bstreams/

(a) 当写入的文件非常小(例如8KB),查看后,发现该文件并没有切分,而是整个只放在一个data server上。

(b)当写入的文件有点大(例如4.2MB),查看后,发现该文件被一分为二,在每个data server节点上有一个块。




















 










内容概要:本文档围绕“经济学期刊论文复现:数字化转型能否促进企业的高质量发展”这一核心命题,系统整合了MATLAB与Python编程实现的大量科研案例,聚焦于数字化转型对企业全要素生产率(TFP)及高质量发展影响的实证研究。文档不仅复现了高水平经济学期刊论文中的计量经济模型,如基于中国上市公司数据的数字化转型与生产率关系分析,还深度融合了工程领域的建模技术,涵盖微电网优化、负荷预测、风电光伏不确定性建模、电力系统故障仿真等。同时,提供了智能优化算法(如遗传算法、粒子群优化)、机器学习(LSTM、CNN-BiGRU-Attention)、信号处理、路径规划等多学科交叉的技术资源,构建了一个从理论推导到代码实现的完整科研支持体系,旨在帮助研究者系统掌握论文复现与实证分析的核心方法。; 适合人群:具备一定MATLAB或Python编程基础,从事经济学、管理学、能源系统、智能制造及相关交叉学科研究的研究生、科研人员及高校教师。; 使用场景及目标:①复现经济学顶刊中关于数字化转型与企业高质量发展的实证模型;②学习如何量化数字化转型并构建其对企业绩效的影响评估框架;③掌握基于真实数据的计量经济建模、场景生成与优化调度仿真技术,全面提升科研论文写作与实证研究能力。; 阅读建议:建议读者结合文中提供的代码与数据资源,重点研读“论文复现”与“创新未发表”模块,按照技术路径循序渐进地实现模型复现与拓展。推荐关注“荔枝科研社”公众号及百度网盘链接获取完整资料,系统性地开展学习与科研实践。
下载代码方式:https://pan.quark.cn/s/9de6a9d0b3d8 依据所提供的文件内容,能够推导出此段程序的核心任务在于对一个任意的三位数进行拆解,并且分别呈现该数值的百位、十位及个位部分。随后,我们将对该知识点进行进一步的深入研究。 ### 一、程序功能说明 #### 1. 接收任意一个三位数输入 程序起始阶段运用`scanf`函数来获取用户输入的一个整数。为确保输入内容确实为一个三位数,在实际应用场景中通常需要嵌入验证机制来保障输入的有效性。然而,在本示例情形下,该环节被简化处理,预设用户总会准确输入一个三位数。 #### 2. 实施数字的拆分并提取各位置数值 程序借助一系列数学计算来对三位数进行拆分,将其转化为百位、十位和个位三个独立的构成部分。具体而言,通过除法和取模运算完成了这一过程。 #### 3. 展示各位置上的数值 程序运用`printf`函数来输出原始数值以及各个位上的数值。需要留意的是,代码中的输出部分似乎存在一些混淆,存在语法上的错误,例如多余的`printf`语句和乱码字符等问题。 ### 二、核心代码分析 #### 1. 数字拆分逻辑 ```c a[0] = n / 1000; // 提取千位数,但鉴于题目要求是三位数,此处应为百位数 a[1] = n % 1000 / 100; // 提取百位数 a[2] = n % 1000 % 100 / 10; // 提取十位数 a[3] = n % 1000 % 100 % 10; // 提取个位数 ``` 这段代码通过一连串的除法和取模运算,成功地将输入的数字n拆分为百位、十位和个位三个独立的构成部分,...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值