Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94898
  • 博文数量: 17
  • 博客积分: 1435
  • 博客等级: 上尉
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-28 16:23
文章分类

全部博文(17)

文章存档

2008年(17)

我的朋友
最近访客

分类: LINUX

2008-04-03 14:40:29

theory是一个mosix集群,主要用于科学计算。

1.结构
Node(x16)
Hardware:
Processer : Dual Athlon MP2000+
Motherboard: S2466 Tiger MPX (TYAN)
Memory : 512MB DDR
Hard Disk : 40GB IDE
NIC : 3Com 3C920(主板集成,驱动用3C905)
Software:
Operation System:Debian 3.0
Packages:
from woody:
mosix mpich pvm gcc(with g77) gdb
jed
systemimager-client
rpm package:
ifc7.0
c3-2.7.2(not functional yet)

Connection:
100Mbps Ethernet Switch

File Server:
Dell

IP & Hostname:
Dominate Name: theory.nju.edu.cn
202.119.45.164
Nodes:
baby3 192.168.22.3
baby4 192.168.22.4
. .
. .
. .
baby18 192.168.22.18
File Server:
mama 192.168.22.2
Gateway:
papa 192.168.22.1






2.systemimager
systemimager是一个linux的clone工具。它是用磁盘镜像的方法来安装系统。
要安装systemimager,要在所有节点机上安装systemimager-client,在服务器上安装systemimager-server
server会启动一个rsync的deamon,systemimager就是用rsync来传输文件的。
首先配置好一个节点,然后运行prepareclient:

Welcome to the SystemImager prepareclient command. This command
may modify the following files to prepare your client for having its
image retrieved by the imageserver. It will also create the
/etc/systemimager directory and fill it with information about your
golden client, such as the disk partitioning scheme(s).

/etc/services -- add rsync line if necessary
/etc/inetd.conf -- comment out rsync line if necessary
(rsync will run as a daemon until shutdown)
/tmp/rsyncd.conf -- create a temporary rsyncd.conf file with a
[root] entry in it.

All modified files will be backed up with the .beforesystemimager
extension.

See "prepareclient -help" for command line options.

Prepare client for SystemImager? (y/[n]):y

Starting or re-starting rsync as a daemon.....done!
This client is ready to have its image retrieved.
You must now run the "getimage" command on the imageserver.

然后在服务器上运行:
getimage -golden-client baby3 -image node4mosix
baby3是配置好的节点,node4mosix是镜像目录名,这个目录缺省是在/var/lib/systemiamger/image下
getimage读取完节点机的信息后,会问你是否配置自动安装:

y 会执行addclients来配置自动安装信息。
服务器上生成镜像后,在其余的节点机上运行updateclient -server mama -image node4mosix
系统就会自动的clone一个节点出来。
Baby4:~# updateclient -server mama -image node4mosix
Updating image...
receiving file list ... done

NOTE:现在我远程登陆后执行updateclient会出错,目前还不知道原因,下面是错误提示
rsync error: partial transfer (code 23) at main.c(925)

systemimager还有一个pushupdate命令,现在也用不起来。

集群各个节点的更新与升级可以用C3 + systemimager来完成:
1.配置好一个节点,prepareclient;
2.在systemimager-server上,用getimage 来更新节点信息;
3.用cexecs -p -c "updateclient ... "在全部节点上更新。

3.mosix
Debian上安装mosix非常简单:
apt-get install kernel-patch-mosix mosix
然后下载一棵干净的源码树,打上补丁就可以了。
下面是编译内核时的MOSIX部分的配置
MOSIX process migration support │ │
支持进程迁移
│ │ [ ] Support clusters with a complex network topology │ │
│ │ [ ] MOSIX Kernel Debugger │ │
│ │ MOSIX Kernel Diagnostics │ │
│ │ Stricter security on MOSIX ports │ │
│ │ (1) Level of process-identity disclosure (0-3) │ │
│ │ [ ] Create the kernel with a "-mosix" extension │ │

│ │ Direct File-System Access │ │
│ │ MOSIX File-System │ │
上面两项是使用MFS文件系统的选项
│ │ [ ] Poll/Select exceptions on pipes

软件包mosix会启动一个mosix deamon,主要是用来
初始化mosix节点机(没有初始化的节点是不能跟其他节点通信的)。
在一个节点上运行mon-mosix
1.00 |
|
|
|
|
0.75 |
|
L |
|
O |
0.50 |
A |
|
D |
|
0.25 |
|
|
|
|
IDLE |
0 -------------------------------------------------------------------------
Node # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
这个界面下,有四个命令可以用
L: LOAD
S: SPEED
R: Raw Used Memory
M: Used Memory

Debian配置mosix的文件是/etc/default/mosix
/etc/default/mosix文件里的设置:
# This node is a Mosix node.
MOSIX_NODE=yes

# Processes are allowed to migrate to other nodes.
MIGRATE=yes

# Allow guest processes to arrive.
BLOCK=no
(以上三项保证MOSIX可以用进程迁移的方法实现负载均衡)
#use MFS
MFS=yes
(可以使用MFS文件系统)
/etc/fstab 文件的内容:
# /etc/fstab: static file system information.
#
#
/dev/hda1 / ext2 errors=remount-ro 0 1
/dev/hda2 none swap sw 0 0
192.168.22.2:/home /home nfs defaults,rsize=4096,wsize=4096 0 0
proc /proc proc defaults 0 0
#/dev/fd0 /floppy auto user,noauto 0 0
#/dev/cdrom /cdrom iso9660 ro,user,noauto 0 0
mymfs /mfs mfs dfsa=1 0 0
最后一行是mount MFS文件系统的
Baby3:~# ls /mfs
1/ 11/ 13/ 15/ 2/ 4/ 6/ 8/ here/ lastexec/ selected/
10/ 12/ 14/ 16/ 3/ 5/ 7/ 9/ home/ magic/
1-16的16个目录分别映射到baby3-baby18的根分区

MOSIX用到的端口
TCP port 4660 for migration;
UDP port 5428 for information dessimination;

MFS uses TCP port 723.


4.mpich
apt-get install mpich
Debian的mpich配置文件是/etc/mpich/machines.UNIX
里面是节点机的列表(不一定是mosix节点)
mpich用rsh来远程启动进程,所以要先设定/etc/hosts,加上所有的节点hostname或ip,
避免rsh使用时要手工输入密码
下面是一个简单的测试程序(fortran 77)
mpit1.f
program main
include 'mpif.h'
character *(MPI_MAX_PROCESSOR_NAME) processor_name
integer myid,numprocs,namelen,rc,ierr

call MPI_INIT(ierr)
call mpi_comm_rank(mpi_comm_world,myid,ierr)
call mpi_comm_size(mpi_comm_world,numprocs,ierr)
call mpi_get_processor_name(processor_name,namelen,ierr)
write(*,10) myid,numproces,processor_name
10 format('hello,world!process ',i2,'of',i1,'on',20a)
call mpi_finalize(rc)
end

用命令f77 mpit1.f -I/usr/include/mpi -lmpi 编译
mpirun -np 4 ./a.out
在另一个shell下启动mon-mosix,可以看到其他node上的load上升
这个程序的输出是:
[yyin@Baby3 ~]$ mpirun -np 4 ./a.out
hello,world!process 0of*onBaby3.theory.nju.edu.cn
hello,world!process 1of*onBaby3.theory.nju.edu.cn
hello,world!process 3of*onBaby5.theory.nju.edu.cn
hello,world!process 2of*onBaby4.theory.nju.edu.cn

5.用户相关
1.如何不用输入密码
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub ~/.ssh/authozied_keys
TODO:
如何使登陆在服务器mama上的用户可以直接让程序在babys上运行?
阅读(926) | 评论(0) | 转发(0) |
0

上一篇:ee使用

下一篇:利用Beowulf让普通PC变集群

给主人留下些什么吧!~~