89
PC-Cluster 架架架架架架 架架架架 -linux-openSuSE 13.1

PC-Cluster 架設圖解教學 作業系統 - linux-openSuSE 13.1

Embed Size (px)

DESCRIPTION

PC-Cluster 架設圖解教學 作業系統 - linux-openSuSE 13.1. PC-Cluster 硬體架構. PC-Cluster 軟體架構. NFS ( N etwork F ile S ystem) Server 它 最大的功能就是可以透過網路,讓不同的機器、不同的作業系統、可以彼此分享個別的檔案 (share files) 。 NIS ( N etwork I nformation S ervice ) Server - PowerPoint PPT Presentation

Citation preview

PC-Cluster -linux-openSuSE 12.1

PC-Cluster -linux-openSuSE 13.1 PC-Cluster

PC-ClusterNFS (Network File System) Server (share files)NIS (Network Information Service) Server SSH SSHMPI (Message Passing Interface)OpenSuse 13.1VirtualBoxOpenSuSeVirtualBoxhttp://download.virtualbox.org/virtualbox/4.3.8/VirtualBox-4.3.8-92456-Win.exe

OpenSuSehttp://software.opensuse.org/131/zh_TWVirtualBox

VM

OS

ISO

Installation

(SSH)SSH()

C/C++

VM

VM

OSroot

IPalien@node1:~> su -Password:node1:~ #node1:~ # ifconfigIP

() (2)

SSH ()

()node1:~ # vi /etc/hosts192.168.1.1 node1192.168.1.2 node2node1:~ # cd /etc/rc.dnode1:/etc/rc.d # ./sshd startnode1:~ # cd /etc/rc.dnode1:/etc/rc.d # ./SuSEfirewall2_setup stop()sshnode1:~ # ssh 192.168.1.2ornode2:~ # ssh 192.168.1.1YaST

(2)

NFS ServerNFS

/home

192.168.1.0/24rw,no_root_squash,sync

192.168.1.0/24rw,no_root_squash,syncrw client no_root_squash root anonymous client root root sync I/O

192.168.1.0/24 Netmask255.0.0.0 (140.0.0.0~140.255.255.255)255.255.0.0 (140.116.0.0~140.116.255.255)255.255.255.0 (140.116.245.0~140.116.245.255)140.0.0.0/8140.116.0.0/16140.116.245.0/24NFS ClientYaSTnode2

umount/homeClient (IPSERVER IP)

umount/home

mount 192.168.1.1:/homenode2:~ # vi /etc/fstab# /home ext4 acl,user_xattr mark(#)192.168.1.1:/home /home nfs defaults 0 0 node2:~ # mount -anode2:~ # umount -l /homenode2:~ # mount t nfs 192.168.1.1:/hmoe /homeNFS

192.168.1.1/home

portmapper

NFS Server node2:~ # rpcinfo -p localhost portmapper 111 port ok node2:~ # rpcinfo -p 192.168.1.1 Server portmapper 111 port oknode2:~ # cd /etc/rc.dnode2: :/etc/rc.d # rpcbind start 111 port rpcbindnode2: :/etc/rc.d # chkconfig rpcbind on node2:~ # showmount -e 192.168.1.1Export list for 192.168.1.1:/home (everyone)NIS ServerYaST

NIS

NIS

shadow

192.168.1.0255.255.255.0

ypserv, yppasswdd NIS node1:~ # /usr/lib/yp/ypinit m

At this point, we have to construct a list of the hosts which will run NIS servers. Server.paching.com.tw is in the list of NIS server hosts. Please continue to addthe names for the other hosts, one per line. When you are done with the list, type a .next host to add: node1 host namenext host to add: Ctrl - DThe current list of NIS servers looks like this: Server.paching.com.twIs this correct? [y/n: y] y y !

NIS ()We need a few minutes to build the databases...Building /var/yp/paching/ypservers...Running /var/yp/Makefile...gmake[1]: Entering directory `/var/yp/paching'Updating passwd.byname...Updating passwd.byuid...Updating group.byname...Updating group.bygid...Updating rpc.byname...Updating rpc.bynumber...Updating services.byname...Updating services.byservicename...Updating netid.byname...gmake[1]: Leaving directory `/var/yp/paching'Server.paching.com.tw has been set up as a NIS master server.Now you can run ypinit -s Server.paching.com.tw on all slave server./ NIS domain name

ypserv.conf

ypserv yppasswddnode1:~ # nisdomainname cluster NIS domain nameclusternode1:~ # nisdomainname NIS domain nameclusternode1:~ # vi /etc/ypserv.conf# Host:Domain:Map:Security# * :*:shadow.byname:port* :*:passwd.adjunct.byname:portnode1:~ # cd /etc/rc.dnode1:/etc/rc.d # ./ypserv startStarting ypserv donenode1:/etc/rc.d # ./yppasswdd startStarting rpc.yppasswdd done() RPC node1:~ # rpcinfo -u localhost ypservprogram 100004 version 1 ready and waitingprogram 100004 version 2 ready and waitingnode1:~ # rpcinfo -u localhost yppasswddprogram 100009 version 1 ready and waitingNIS ClientYaSTNIS

NIS

192.168.1.1

NISServersshClientnode1:~ # useradd username -m -s /bin/bashnode1:~ # passwd usernamenode1:~ # /usr/lib/yp/ypinit mnode1:~ # su usernamenode1:~ # ssh 192.168.1.2 yp.conf

Client node2:~ # vi /etc/yp.conf

# NIS Domain Namedomain cluster

# Client NIS Serverypserver node1node2:~ # vi /etc/nsswitch.confpasswd :filesnisshadow :filesnisgroup : filesnishosts :filesnisdnsNsswitch.conf passwd /etc/passwd NIS Server shadow /etc/shadow NIS Server group /etc/group NIS Server hosts /etc/hosts NIS Server NIS /etc/resolv.conf () /etc/passwdnode2:~ # vi /etc/passwdmysql : x : 60 : 103 : MySQL database admin : /var/lib/mysql : /bin/bashdhcpd : x : 102 : 65534 : DHCP server daemon : /var/lib/dhcp : /bin/falsepop : x : 67 : 100 : POP admin : /var/lib/pop : /bin/false + : : : : : :

# process NIS # " + " " : " () ypbindnode2:~ # cd /etc/rc.dnode2:/etc/rc.d # ./ypbind startStarting ypbind donenode2:~ # rpcinfo -u localhost ypbindprogram 100007 version 1 ready and waitingprogram 100007 version 2 ready and waitingsshClientSSHD (2)/etc/ssh/sshd_config2node1:~ # vi /etc/ssh/sshd_config#StrictModes no #no # PubkeyAuthentication yes ## AuthorizedKeysFile .ssh/authorized_keys #node1:~ # cd /etc/rc.dnode1: ~ # /etc/rc.d/sshd restart sshdpublic keypublic key (!!)

cat authorized_keys alien@node1:~ # ssh-keygen Generating public/private rsa key pair.Enter file in which to save the key (/home/username/.ssh/id_rsa): enterCreated directory '/homeusername/.ssh'. Enter passphrase (empty for no passphrase): Enter Enter same passphrase again: Enter Your identification has been saved in /home/username/.ssh/id_rsa. Your public key has been saved in /home/username/.ssh/id_rsa.pub. The key fingerprint is:0f:d3:e7:1a:1c:bd:5c:03:f1:19:f1:22:df:9b:cc:08alien@node1:~ # cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keysalien@node1:~ # ssh node2oralien@node1:~ # ssh 192.168.1.2MPIYaST

/

gcc/gcc-c++

MPICLIENTnode2:~ # cd /optnode2:~ # mkdir mpichMPICLIENT

NFS/opt/mpich (/home)

node2:~ # cd /optnode2:~ # mkdir mpichMPIalien@node1:~ # PATH=/opt/mpich/ch-p4mpd/bin:$PATH ; export PATHalien@node1:~ # touch .mpd.conf alien@node1:~ # chmod 600 .mpd.confalien@node1:~ # vi ~/.mpd.confsecretword= alien@node1:~ # vi ~/mpd.hostsnode1:1node2:1alien@node1:~ # mpd &alien@node1:~ # mpdtracempdtrace: node1_39182: lhs=node1_39182 rhs=node1_39182 rhs2=node1_39182 gen=1alien@node1:~ # ssh -n node2 /opt/mpich/ch-p4mpd/bin/mpd -h node1 -p 39182 &alien@node1:~ # mpicc -c cpi.calien@node1:~ # mpicc -o cpi cpi.o lmalien@node1:~ # mpirun -np 4 ./cpimachinefile

alien@node1:~ # PATH=/opt/mpich/ch-p4mpd/bin:$PATH ; export PATHalien@node1:~ # mpicc -c cpi.calien@node1:~ # mpicc -o cpi cpi.o lmalien@node1:~ # mpirun -machine ./machinefile -np 1 ./cpialien@node1:~ # vi machinefilenode1:2node2:2