Diskless Cluster 연합세미나(수원대학교)

Download Report

Transcript Diskless Cluster 연합세미나(수원대학교)

DISKLESS CLUSTER
수원대학교
Linuxus
전체 네트워크 구성도
Diskless Cluster 네트워크 구성도
Diskless server
Node1
Node2
Node3
Node n…
# Diskless server : Node들에게 kernel 과 root 파일 시스템 제공
DHCP 서버로 Node에 각각 IP할당
# Node : Diskless server 의 자원을 이용해서 부팅(Netbooting)
Diskless Cluster 부팅과정
1. Diskless Node 를 부팅 시작
2. 네트워크 카드가 자신에 대한 정보를 네트워크에서 찾음
3. DHCP 서버가 MAC 주소를 인식하고 IP 할당
4. pxelinux.0 과 Kernel 을 서버(Diskless server) 에서 받음
5. 시스템을 시작하고 NFS 를 이용해서 root 파일 시스템을 마운트
<참고: Diskless Node 들의 NIC Card가 PXE 를 지원하는지 확인 >
Client Kernel 만들기
이 작업은 Diskless server에서 수행하게 되며 HDD가 없이 Booting 되는 것이므로
Netbooting이 가능 하도록 Kernel 옵션을 설정해주면 된다.
그리고 설치된 NIC 를 지원하도록 설정을 해 주어야 한다.
# make menuconfig
Device Driver  Networking options 
※ 커널 수준에서 Netbooting이 가능하도록 설정
Client Kernel 만들기
File systems  Network File Systems 
※Kernel 수준에서 NFS 를 지원하도록 설정
# make dep ; make ; make modules_install ; make install  커널 컴파일
이 작업이 끝나고 나면 /boot 디렉토리에 vmlinuz-[커널버전] 이라는 커널이 생성.
생성된 커널을 이용하여 Diskless Node 들을 부팅
TFTP 설정
tftp 설치후 /etc/xinetd.d/tftp 파일을 다음과 같이 수정
# cat /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
 yse 를 no 로 수정
 pxelinux.0 가 저장된 디렉토리
PXE 설정


PXE 는 network 가 network 를 통해서 boot code 를 load 하는 표준이다.
PXELINUX 설명서에 의하면 client는 자신의 MAC 주소를 이용하여 설정파일을 찾는다.
MAC 주소가 00:11:22:33:44:55:66 이라면 /tftpboot/pxelinux.cfg/01-00-11-22-33-4455-66 파일을 찾고 없을 시 /tftpboot/pxelinux.cfg/default 파일을 사용한다.

여러 대가 같은 설정일 경우 default 파일을 사용하는 것이 편리하다.

MAC 주소가 XX:XX:XX:XX:XX:XX:XX 의 파일 찾는 순서
/tftpboot/pxelinux.cfg/01-XX-XX-XX-XX-XX-XX
/tftpboot/pxelinux.cfg/C0A80A0A
/tftpboot/pxelinux.cfg/C0A80A0
/tftpboot/pxelinux.cfg/C0A80A
/tftpboot/pxelinux.cfg/C0A80
/tftpboot/pxelinux.cfg/C0A8
/tftpboot/pxelinux.cfg/C0A
/tftpboot/pxelinux.cfg/C0
/tftpboot/pxelinux.cfg/C
/tftpboot/pxelinux.cfg/default
설정 파일 찾는 순서
1./tftpboot/pxelinux.cfg/01-[MAC 주소]
2./tftpboot/pxelinux.cfg/[IP 주소]
3./tftpboot/pxelinux.cfg/default
PXE 설정
http://www.kernel.org/pub/linux/utils/boot/syslinux에서 syslinux-3.31 다운로드
압축 해제 후 pxelinux.0 파일을 /tftpboot 디렉토리 생성 후 복사.
/tftpboot/pxelinux.cfg 디렉토리 를 생성 후 default 파일 생성 및 수정
# cat /tftpboot/pxelinux.cfg/default
label linux
kernel DisklessKernel
 커널명 /tftpboot 디렉토리에 위치함
append root=/dev/nfs ip=dhcp init=/sbin/init
클라이언트 File System 생성
#mkdir /tftpboot/192.168.10.3  directory 디렉토리 생성
# cp -a /bin /boot /dev /etc /lib /sbin /tftpboot/192.168.10.3  부팅에 필요한 파일, 디렉토리 복사
[root@Cluster5 192.168.10.3]# cat /tftpboot/192.168.10.3/etc/fstab  fstab 설정
192.168.10.5:/tftpboot/192.168.10.3
192.168.10.5:/usr
192.168.10.5:/home
192.168.10.5:/opt
192.168.10.5:/var
192.168.10.5:/root
none
none
none
none
/dev/had
/media/cdrom
auto
/
nfs
rw,defaults
/usr
nfs
rw,defaults
/home
nfs
rw,defaults
/opt
nfs
rw,defaults
/var
nfs
rw,defaults
/root
nfs
rw,defaults
/dev/pts devpts gid=5,mode=620
/dev/shm tmpfs
defaults
/proc
proc
defaults
/sys
sysfs
defaults
pamconsole,exec,noauto,managed
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
클라이언트 Network 설정

# cat /tftpboot/192.168.10.3/etc/sysconfig/network-scripts/ifcfg-eth0  IP 설정
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.10.255
HWADDR=00:D0:B7:B8:73:57
IPADDR=192.168.10.3
NETMASK=255.255.255.0
NETWORK=192.168.10.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
※ Diskless Node2를 위해 /tftpboot/192.168.10.4 디렉토리 를 만들고 위와 같은 형식으로 작업 수행
DHCP 설정
# cat /etc/dhcpd.conf
ignore client-updates;
option domain-name-servers 168.126.63.1;
option routers 192.168.10.5;
 DNS 서버 IP
 서비스 하는 server 의 IP
subnet 192.168.10.0 netmask 255.255.255.0 {
 서비스 하는 server 의 network, subnet
option time-offset -18000; # Eastern Standard Time
default-lease-time 21600;
max-lease-time 43200; }
group {
filename "pxelinux.0";
use-host-decl-names on;
host node1 {
fixed-address 192.168.10.3;
hardware ethernet 00:D0:B7:B8:73:57;
option root-path "/tftpboot/192.168.10.3"; }
 node 1 의 설정내용
 node 1 에게 할당할 IP 주소
 client 의 MAC 주소
 node1 이 사용할 root 디렉토리
host node2 {
fixed-address 192.168.10.4;
hardware ethernet 00:D0:B7:B8:71:EB;
option root-path "/tftpboot/192.168.10.4"; }
}
 node 2 의 설정내용
 node 2 에게 할당할 IP 주소
 client 의 MAC 주소
 node2 가 사용할 root 디렉토리
NFS 설정

file system의 일부를 client 에게 제공하여 client 의 root file system으로 mount 할 수
있도록 해야 한다.

iptables -F 명령으로 방화벽을 내리고 시작하는 것이 좋음 방화벽은 차후에 설정.

[root@Cluster5 ~]# cat /etc/exports
/tftpboot/192.168.10.3 *(rw,sync,no_root_squash,no_subtree_check)
/tftpboot/192.168.10.4 *(rw,sync,no_root_squash,no_subtree_check)
/usr
*(rw,sync,no_root_squash,no_subtree_check)
/opt
*(rw,sync,no_root_squash,no_subtree_check)
/var
*(rw,sync,no_root_squash,no_subtree_check)
/home
*(rw,sync,no_root_squash,no_subtree_check)
/root
*(rw,sync,no_root_squash,no_subtree_check)
※ ‘*’ 대신 mount 허용하고 싶은 IP 를 적어 주어도 된다.
# showmount -e 또는 # exportsfs -v 명령어로 마운트 가능한 디렉토리를 볼수 있다
# mknod /dev/nfs c 0 255
 접근이 가능하도록 장치파일을 생성
# rdev /tftpboot/DisklessKernel /dev/nfs
 /dev/nfs device를 root file system으로 mount 하여 사용