Linux 설치시 설치상태나, 설치 단계에서부터 몇가지 체크하고 모니터링 할게 있어서, SSH로 접근 하면 좀 편하지 않을까 싶어서, Ananconda가 Load되면서 SSH를 뛰울 수 있는 방법이 없나~ 하다가... 아주 썩 깔끔한 방법은 아니지만, 우선 급한대로 원하는 결과만(?) 만들어 내어 일단 메모해둔다. (보안같은 부분은 추가적으로 해줘야 한다.. SSH가 root로 비번도 없이 로그인 되니... pass를 미리 설정하던지, Allow인자를 활용하던지.. 아무튼, 꼭 보안은 별도로 신경 써줘야 한다...)


1. 환경

TFTP/PXE로 isolinux 이미지들을 바탕으로 설치

isolinux중에서 initrd.img 이미지를 편집하는 것으로 처리.


2. initrd.img 풀어 해치기~

# cd <initrd.img가 있는 디렉토리>

# mkdir initrd

# cd initrd

# zcat ../initrd.img | cpio -idv

# ls -al

drwxr-xr-x 15 root root 4096 Apr  8 19:54 .

drwxr-xr-x  4 root root 4096 Apr  8 19:53 ..

-rw-r--r--  1 root root  134 Apr  8 19:54 .bash_history

lrwxrwxrwx  1 root root    4 Apr  8 19:54 bin -> sbin

-rw-r--r--  1 root root   78 Apr  8 19:54 .buildstamp

drwxr-xr-x  2 root root 4096 Apr  8 19:54 dev

drwxr-xr-x 16 root root 4096 Apr  8 19:54 etc

drwxr-xr-x 18 root root 4096 Apr  8 19:54 firmware

lrwxrwxrwx  1 root root   10 Apr  8 19:54 init -> /sbin/init

drwxr-xr-x  3 root root 4096 Apr  8 19:54 lib

drwxr-xr-x  4 root root 4096 Apr  8 19:54 lib64

drwxr-xr-x  3 root root 4096 Apr  8 19:54 modules

drwxr-xr-x  2 root root 4096 Apr  8 19:54 proc

-rw-r--r--  1 root root  157 Apr  8 19:54 .profile

drwxr-xr-x  2 root root 4096 Apr  8 19:54 sbin

drwxr-xr-x  2 root root 4096 Apr  8 19:54 selinux

drwxr-xr-x  2 root root 4096 Apr  8 19:54 sys

drwxr-xr-x  2 root root 4096 Apr  8 19:54 tmp

drwxr-xr-x  7 root root 4096 Apr  8 19:54 usr

drwxr-xr-x  7 root root 4096 Apr  8 19:54 var


3. ssh 데몬 실행을 위한 준비
(다행이 Anaconda 이미지에 sshd 바이너리나 기본적인 설정파일은 미리 준비되어 있었다.)

# cd <이전 단계에서 initrd.img를 풀어둔 디렉토리>

# ssh-keygen -b 1024 -f etc/ssh/ssh_host_key -N "" -t rsa1

# ssh-keygen -d -f etc/ssh/ssh_host_rsa_key -N "" -t rsa

# ssh-keygen -d -f etc/ssh/ssh_host_dsa_key -N "" -t dsa

# cp -a etc/ssh/sshd_config.anaconda etc/ssh/sshd_config

# cat etc/ssh/sshd_config
(Port를 변경하고 싶으면 변경하면 되고, 기타 옵션 조정을 원하면 알아서....)

Port 22

HostKey /etc/ssh/ssh_host_key

HostKey /etc/ssh/ssh_host_rsa_key

HostKey /etc/ssh/ssh_host_dsa_key

PermitRootLogin yes

IgnoreRhosts yes

StrictModes yes

X11Forwarding yes

X11DisplayOffset 10

PrintMotd yes

XAuthLocation /sbin/xauth

KeepAlive yes

SyslogFacility AUTHPRIV

RSAAuthentication yes

PasswordAuthentication yes

PermitEmptyPasswords yes

PermitUserEnvironment yes


4. Anaconda 로딩 시, sshd 자동 실행 처리
(이부분이 참... 원래 init 스크립트가 그냥 bash 쉘 스크립트였는데, CentOS6부터 바꼈는지, 컴파일 되어 있다..ㅡ.ㅡ;; 어쨌든, 훼이크성 편법이지만, 부팅중 실행되는 바이너리 중 하나를 바꿔치기 해서 /usr/sbin/sshd가 실행되도록 임시 처리 했다.... 만만한게 auditd 였다.. 추후 정상적인 init프로세스에 추가 할수 있는 방법을 찾으면 수정..)

# cd <이전 단계에서 initrd.img를 풀어둔 디렉토리>

# cd sbin

# mv auditd auditd.orig

# cat > auditd << EOF

#!/bin/bash

/sbin/sshd

/sbin/auditd.orig

EOF

# chmod 755 auditd


5. SSH 설정작업은 끝... 작업했던 디렉토리 내용을 다시 initrd.img로 묶어준다.

# cd <이전 단계에서 initrd.img를 풀어둔 디렉토리>

# find . | cpio -H newc -o | gzip -9 > ../initrd.img


6. 이제 다시 설치를 시도해서, 설치 과정중 해당 서버로 SSH접속을 시도해본다.

- Password는 없이 바로 로그인 된다.

- 다른 사전 작업이 필요하다면, 각자 처리 해둔다.


이상, 끝..... 서두에 이야기 했듯이... sshd를 실행하는 것이 정상적이진 않다... 시간이 되는대로 CentOS 6 Anaconda의 init과정을 좀 파봐야 겠다... 뭔가 나오면 그때 문서 업데이트하기로 하고 오늘은 이정도로만....

Posted by 사랑줍는거지
,

오늘 예전에 같이 동고동락(?)했던 SE분께 놀러 갔다가 딱 걸렸다..ㅡ.ㅡ;; 그쪽 고객중에서 사내 업무에 필요한 관계로, LiveCD를 커스터마이징하는 방법을 요청 했다고....

뭐 대충 보니, LiveCD에 각종 드라이버나, 유지보수 할수 있는 도구들을 담아두고, 유사시에 LIveCD를 응급복구 용도로 사용할려는 것 같다. 이전에는 WindowsPE를 커스트마이징 해서 사용해 온듯 하나, 라이센스 문제가 불거저 더이상 사용하지 못하게 된것 같기도 하고...

아무튼, 이야기를 들어보니, LIveCD의 커널에 특정 하드웨어(Disk 드라이버나 NIC 드라이버) 모듈을 추가 하는 작업은 아니라, 단순히 Linux OS에서 사용할 유틸리티 파일들을 추가 해두려는 것이라, 바로 테스트 해봤다.

Linux 기반에 원격설치서비스(RIS)구축을 해본적이 있어, "벌거 있겠어?? 그놈이 그놈이겠지.." 했는데, 역시나, 쉬운게 없다..ㅡ.ㅡ;;

먼저 맞닥드린건, Fedora16이라는 최신 시스템...ㅡ.ㅡ;; 그간 관심밖에 있었던 Linux 부팅 프로세스가 엄청 낯설었다.... (정말 이 분야에서도 이제 퇴출될 날이 곧.........) 부트 프로세스에 대해 대충이라도 파악하기 위해, initramfs의 init 스크립트를 한참 봤다... 대략 "이런식이구나..." 보구 나니, 표현과 디렉토리 구조, 그리고 패키징 포맷정도가 달라지고 이전과 개념적으로는 거의 비슷....

해서 오늘의 목적인 "Root-Image 파일에 원하는 유틸리티를 빨랑 박아 넣고 끝내자~~" 로 패스...

추적해보니 Root-Image는 squashfs.img라는 파일... 이걸 다시 푸니, 또 ext3fs.img가 나왔다..(뭐가 일케 꼬아 놨어..ㅡ.ㅡ;;) 대충 풀고, 필요한 파일 박아 넣고, 다시 역순으로 패키징하고... 하는 과정에서 개삽질 연속....

역순 패키징할때, 원래 디렉토리 구조로 안해서 한참을 헛짓...ㅡ.ㅡ;; (진짜 죽어야 겄다...)
또 오랜만에 mkisofs랑 mksquashfs 사용할려니 버벅버벅... Error 줄줄............ 아무튼 어떻게 저렇게 마무리...

단순히, 유틸리티들을 Root-Image에 복사해 넣어 두는 것이지만, 까먹지 않기 위해 개인 Wiki에 메모....
다음에, 특정 H/W 모듈도 추가 해야 할 일이 있을 때, 참고하면 도움도 될것 같다...


Wiki : http://redmine.nehome.net/redmine/projects/linux/wiki/LiveCD_-_Edit_Fedora_LiveCD's_Root-Image  



LiveCD - Edit Fedora LiveCD's Root-Image

  • (Note)
    • LiveCD와 동일 배포본인 OS에서 작업하는 것이 여러가지로 안전할듯...

Root 이미지 파일 추출

# cd /usr/local/src

# mkdir /mnt/tmp

# mount Fedora16-LiveCD.iso /mnt/tmp
mount: warning: /mnt/tmp/ seems to be mounted read-only.

(나중에 ISO 이미지 생성시, 필요하므로 미리 복사해둠...)
# cp -a /mnt/tmp iso-src

# ls -al /mnt/tmp/
total 30
dr-xr-xr-x. 5 4294967295 4294967295   224 Mar 25 20:33 .
drwxr-xr-x. 3 root       root        4096 Mar 25 23:57 ..
dr-xr-xr-x. 3 4294967295 4294967295    84 Mar 25 19:16 EFI
-r--r--r--. 1 4294967295 4294967295 18092 Mar 25 19:17 GPL
dr-xr-xr-x. 2 4294967295 4294967295   444 Mar 25 19:16 isolinux
dr-xr-xr-x. 2 4294967295 4294967295   200 Mar 25 19:18 LiveOS

# cp /mnt/tmp/LiveOS/squashfs.img /usr/local/src/

# umount /mnt/tmp

# mount squashfs.img /mnt/tmp
mount: warning: /mnt/tmp/ seems to be mounted read-only

# ls -al /mnt/tmp/
total 5
drwx------. 3 root root   29 Mar 25 19:18 .
drwxr-xr-x. 3 root root 4096 Mar 25 23:57 ..
drwxr-xr-x. 2 root root   33 Mar 25 19:18 LiveOS

# tree /mnt/tmp/
/mnt/tmp/
└── LiveOS
    └── ext3fs.img

1 directory, 1 file

# cp /mnt/tmp/LiveOS/ext3fs.img /usr/local/src/

# umount /mnt/tmp

Root-Image 에 원하는 작업 처리.

일단, 마운트 하기

# mount ext3fs.img /mnt/tmp

# ls -al /mnt/tmp/
total 116
dr-xr-xr-x.   2 root root  4096 Mar 25 19:14 bin
dr-xr-xr-x.   5 root root  4096 Mar 25 19:18 boot
drwxr-xr-x.   4 root root  4096 Mar 25 19:10 dev
drwxr-xr-x. 116 root root 12288 Mar 25 19:18 etc
drwxr-xr-x.   2 root root  4096 Jul 29  2011 home
dr-xr-xr-x.  11 root root  4096 Mar 25 19:12 lib
dr-xr-xr-x.  11 root root 12288 Mar 25 19:18 lib64
drwx------.   2 root root 16384 Mar 25 18:50 lost+found
drwxr-xr-x.   2 root root  4096 Jul 29  2011 media
drwxr-xr-x.   2 root root  4096 Jul 29  2011 mnt
drwxr-xr-x.   2 root root  4096 Jul 29  2011 opt
drwxr-xr-x.   2 root root  4096 Mar 25 18:50 proc
dr-xr-x---.   2 root root  4096 Mar 25 19:14 root
drwxr-xr-x.  22 root root  4096 Mar 25 19:13 run
dr-xr-xr-x.   2 root root 12288 Mar 25 19:14 sbin
drwxr-xr-x.   2 root root  4096 Jul 29  2011 srv
drwxr-xr-x.   2 root root  4096 Mar 25 18:50 sys
drwxrwxrwt.   2 root root  4096 Mar 25 19:17 tmp
drwxr-xr-x.  13 root root  4096 Mar 25 19:08 usr
drwxr-xr-x.  17 root root  4096 Mar 25 19:13 var

원하는 파일 넣기.

  • 원하는 위치에 복사 해넣고 umount하면 됨.
  • (Note)
    • tmp류의 디렉토리의 경우, LiveCD가 부팅되면서 초기화를 하므로, 별도의 디렉토리를 생성후, 파일 복사해야 함.

패키지 설치/제거.

# chroot /mnt/tmp

(설치)
# yum install [패키지]

(제거)
# yum remove [패키지]

작업 완료되었으면, umount

  • ext3fs.img 파일의 size가 4GB로 제한되어 있으니, 데이타 추가시 용량에 신경 써야 함.
  • 필요시, ext3fs.img 파일을 새로(더 큰용량으로) 생성하여 작성도 가능할듯...
# umount /mnt/tmp

추출 및 변경/추가된 Root-Image 재작성.

# mkdir LiveOS

# mv ext3fs.img LiveOS/

(삭제 해주지 않으면, 이전 파일에 Append 됨. -noappend 옵션을 주면 되나, 수정전 원본은 삭제해준다.)
# rm squashfs.img

# mksquashfs LiveOS squashfs.img -keep-as-directory -all-root
Source directory entry LiveOS already used! - trying LiveOS_1
[===|

# cp squashfs.img iso-src/LiveOS

(ISO로 만들 Source 디렉토리 외부에 boot정보 파일이 있어야 mkisofs가 정상 작동...)
# cp -a iso-src/isolinue isolinux

# mkisofs -udf -V "Fedora16-LiveCD" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-info-table -boot-load-size 4 -o Fedora16-LiveCD-New.iso iso-src
I: -input-charset not specified, using utf-8 (detected in locale settings)
Size of boot image is 4 sectors -> No emulation
  1.24% done, estimate finish Mon Mar 26 00:13:36 2012
  2.47% done, estimate finish Mon Mar 26 00:13:36 2012
  3.71% done, estimate finish Mon Mar 26 00:13:36 2012
  4.94% done, estimate finish Mon Mar 26 00:13:36 2012
  6.18% done, estimate finish Mon Mar 26 00:13:36 2012
  7.42% done, estimate finish Mon Mar 26 00:13:49 2012
  8.65% done, estimate finish Mon Mar 26 00:13:47 2012
  9.89% done, estimate finish Mon Mar 26 00:13:46 2012
 11.12% done, estimate finish Mon Mar 26 00:13:44 2012
 12.36% done, estimate finish Mon Mar 26 00:13:44 2012
 13.59% done, estimate finish Mon Mar 26 00:13:43 2012
 14.83% done, estimate finish Mon Mar 26 00:13:42 2012
 16.06% done, estimate finish Mon Mar 26 00:13:48 2012
.
.
.

생성된 Fedora16-LiveCD-New.iso 로 부팅해서, 커스터마이징 해뒀던 상태가 반영되었는지 확인한다.

  • 금번 테스트에서는 간단히 /home과, /root 디렉토리에 call518이라는 텍스트 파일을 넣어 봤다.
  • 아래는 스크린샷....

     





Posted by 사랑줍는거지
,

Install OpenNebula-2.2-1 with Xen

Reference
http://opennebula.org
http://downloads.dsa-research.org/opennebula

Environments

Tested environments info

Test System / Network

- On VMware ESXi
- One vSwitch
- Two VMs
- VM IP Range : 192.168.100.151~160 (10EA)
- By root privileges
- Run "yum -y update" on all nodes
- Template VM Image : CentOS 5.6 x86_64

Test Nodes

- Management Node 
    - IP : 192.168.100.121 (one-01)
    - OS : CentOS 5.6 x86_64 (2.6.18-238.9.1.el5)
    - 1Core / 384RAM
- Xen Node IP : 192.168.100.122
    - IP : 192.168.100.122 (one-02)
    - OS : CentOS 5.6 x86_64 (2.6.18-238.19.1.el5xen)
    - 2Core / 1024RAM

On whole nodes

Add to /etc/hosts

192.168.100.121 one-01
192.168.100.122 one-02

On Management Node

Install OpenNebula & Setup Env.

# cd /usr/local/src

Download opennebula-2.2-1.x86_64.rpm to /usr/local/src/ (from http://downloads.dsa-research.org/opennebula)

# wget  ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/SRPMS/xmlrpc-c-1.06.18-1.el5.kb.src.rpm

# ls -al /usr/local/src/
-rw-r--r--  1 root root     717867 Jul 22 13:53 opennebula-2.2-1.x86_64.rpm
-rw-r--r--  1 root root     708799 Jul 23 21:49 xmlrpc-c-1.06.18-1.el5.kb.src.rpm

# yum install ruby ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc

# rpmbuild --rebuild xmlrpc-c-1.06.18-1.el5.kb.src.rpm

# rpm -Uvh /usr/src/redhat/RPMS/x86_64/xmlrpc-c-*

# rpm -Uvh opennebula-2.2-1.x86_64.rpm

Setup OpenNebula Admin User & Env

# echo "export ONE_XMLRPC=http://localhost:2633/RPC2" >> /etc/profile

# echo "export ONE_AUTH=/home/oneadmin/one_auth" >> /etc/profile

# useradd oneadmin -d /home/oneadmin

# echo "oneadmin:1234" > /home/oneadmin/one_auth

SSH Key Create & Setup sudo

# mkdir /home/oneadmin/.ssh

# ssh-keygen -t rsa -N '' -f /home/oneadmin/.ssh/id_rsa

# cp -a /home/oneadmin/.ssh/id_rsa.pub /home/oneadmin/.ssh/authorized_keys

# chmod 700 /home/oneadmin/.ssh

# chown -R oneadmin:oneadmin /home/oneadmin/.ssh

# sed -i 's/^Defaults    requiretty/# /g' /etc/sudoers

Add to /etc/ssh/ssh_config

Host *
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

On Xen Node

Install Xen

# yum install ruby ebtables

# yum groupinstall Vritualization

# useradd oneadmin -d /home/oneadmin

# reboot

# virsh net-destroy default

# virsh net-undefine default

SSH Key Create & Setup sudo

# mkdir /home/oneadmin/.ssh

# scp root@one-01:/home/oneadmin/.ssh/* /home/oneadmin/.ssh/

# chonw -R oneadmin:oneadmin /home/oneadmin/.ssh

# sed -i 's/^Defaults    requiretty/# /g' /etc/sudoers 

Add to /etc/ssh/ssh_config

Host *
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

on Xen Node

Create Xen Template Image

# virt-install --name centos5_64 --ram 384 --paravirt --location=http://ftp.daum.net/centos/5/os/x86_64/ --file=/home/oneadmin/centos5_64.xen.img -s 1.5

** Install Minimal Package

On VM Template Image - Setup VM Env. (After Installation & Reboot)

# echo "/var/lib/one/one-boot-init.sh" >> /etc/rc.local

# mkdir /var/lib/one/
# vi /var/lib/one/one-boot-init.sh
#!/bin/bash

DEV_CD="/dev/xvdc" 
MNT="media/one" 
CHK_FILE="/var/lib/one/.done_context" 

if [ -b ${DEV_CD} ]; then
        mount -t iso9660 ${DEV_CD} ${MNT}
        if [ -f ${MNT}/context.sh ]; then
                . ${MNT}/init.sh
        fi
        umount ${MNT}
        if [ ! -e ${CHK_FILE} ]; then
                touch ${CHK_FILE}
                chattr +i ${CHK_FILE}
        fi
fi

exit 0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Xen Virtual Ethernet
DEVICE=eth0
BOOTPROTO=static
ONBOOT=no
# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain

- Default Runlevel is 3 (/etc/inittab)
- Auto Started Service is Compact (chkconfig & ntsysv)

# sed -i 's/^id:.*/id:3:initdefault:/g' /etc/inittab

# chkconfig --list | grep "3:on" 
acpid              0:off    1:off    2:on    3:on    4:on    5:on    6:off
cpuspeed           0:off    1:on    2:on    3:on    4:on    5:on    6:off
crond              0:off    1:off    2:on    3:on    4:on    5:on    6:off
haldaemon          0:off    1:off    2:off    3:on    4:on    5:on    6:off
iptables           0:off    1:off    2:on    3:on    4:on    5:on    6:off
irqbalance         0:off    1:off    2:on    3:on    4:on    5:on    6:off
messagebus         0:off    1:off    2:off    3:on    4:on    5:on    6:off
network            0:off    1:off    2:on    3:on    4:on    5:on    6:off
sshd               0:off    1:off    2:on    3:on    4:on    5:on    6:off
syslog             0:off    1:off    2:on    3:on    4:on    5:on    6:off

- Copy Template Image to Management Node

# scp /home/oneadmin/centos5_64.xen.img root@one-01:/home/oneadmin/

On Management Node

Setup : NFS Export (for VM_DIR)

# vi /etc/exports
/var/lib/one            192.168.100.122(rw,no_root_squash)
/usr/share/one/hooks    192.168.100.122(rw,no_root_squash)
# exportfs -avr

# chkconfig portmap on

# chkconfig nfs on

# chkconfig nfslock on

# service portmap start

# service nfs start

# service nfslock start

On Xen Node

Mount NFS

# echo "one-01:/var/lib/one/ /var/lib/one nfs defaults 0 0" >> /etc/fstab

# echo "one-01:/usr/share/one/hooks /usr/share/one/hooks nfs defaults 0 0" >> /etc/fstab

# mkdir -p /usr/share/one/hooks

# mount -a

On Management Node

Configuration OpenNebula (oned.conf)

# vi /etc/one/oned.conf
HOST_MONITORING_INTERVAL = 60

VM_POLLING_INTERVAL      = 60

SCRIPTS_REMOTE_DIR=/var/tmp/one

PORT=2633

DB = [ backend = "mysql", server = "localhost", port = "3306", user = "root", passwd = "1234", db_name = "one" ]

VNC_BASE_PORT = 5900

DEBUG_LEVEL=3

NETWORK_SIZE = 254

MAC_PREFIX   = "02:00" 

DEFAULT_IMAGE_TYPE    = "OS" 

DEFAULT_DEVICE_PREFIX = "xvd" 

IM_MAD = [
    name       = "im_xen",
    executable = "one_im_ssh",
    arguments  = "xen" ]

VM_MAD = [
    name       = "vmm_xen",
    executable = "one_vmm_ssh",
    arguments  = "xen",
    default    = "vmm_ssh/vmm_ssh_xen.conf",
    type       = "xen" ]

TM_MAD = [
    name       = "tm_nfs",
    executable = "one_tm",
    arguments  = "tm_nfs/tm_nfs.conf" ]

HM_MAD = [
    executable = "one_hm" ]

VM_HOOK = [
    name      = "image",
    on        = "DONE",
    command   = "image.rb",
    arguments = "$VMID" ]

VM_HOOK = [
    name      = "ebtables-start",
    on        = "running",
    command   = "/usr/share/one/hooks/ebtables-xen", # or ebtables-xen 
    arguments = "one-$VMID",
    remote    = "yes" ]

VM_HOOK = [
    name      = "ebtables-flush",
    on        = "done",
    command   = "/usr/share/one/hooks/ebtables-flush",
    arguments = "",
    remote    = "yes" ]
# service oned stop

# service oned start

Add Xen Node

# onehost create one-02 im_xen vmm_xen tm_nfs

..... wait a minute...

# onehost list
  ID NAME              CLUSTER  RVM   TCPU   FCPU   ACPU    TMEM    FMEM STAT
   0 one-02            default    1    200    196    100      2G    768M   on

Prepare Virtual Network Template

# vi /home/oneadmin/template.vnet.public
NAME = "Public" 
TYPE = "FIXED" 
BRIDGE = "xenbr0" 

LEASES = [ IP = "192.168.100.151" ]
LEASES = [ IP = "192.168.100.152" ]
LEASES = [ IP = "192.168.100.153" ]
LEASES = [ IP = "192.168.100.154" ]
LEASES = [ IP = "192.168.100.155" ]
LEASES = [ IP = "192.168.100.156" ]
LEASES = [ IP = "192.168.100.157" ]
LEASES = [ IP = "192.168.100.158" ]
LEASES = [ IP = "192.168.100.159" ]
LEASES = [ IP = "192.168.100.160" ]

Cretate Virtual Network

# onevnet create /home/oneadmin/template.vnet.public

# onevnet list
  ID USER     NAME              TYPE BRIDGE P #LEASES
   1 oneadmin Public           Fixed xenbr0 N       1

Prepare Virtual Machine Template

# vi /home/oneadmin/template.vm.centos5_64
CPU    = 1

MEMORY = 256

OS = [ bootloader = "/usr/bin/pygrub" ]

#DISK  = [
#  IMAGE ="Xen-CentOS5_64",
#  target = "xvda" ]

DISK = [
  source   = "/home/oneadmin/centos5_64.xen.img",
  target   = "xvda",
  readonly = "no" ]

DISK  = [
  type = "swap",
  size = "1024",
  target = "xvdb" ]

DISK  = [
  type = "fs",
  format = "ext3",
  size = "20480",
  target = "xvdd" ]

NIC = [ NETWORK="Public" ]

GRAPHICS = [ 
  type    = "vnc",              
  listen  = "127.0.0.1" ]

CONTEXT = [
  files = "/home/oneadmin/init.sh /home/oneadmin/.ssh/id_rsa.pub /home/oneadmin/setup-network.sh",
  root_pubkey = "id_rsa.pub",
  VMID = "$VMID",
  target = "xvdc" ]

Create Default Context Files

# vi /home/oneadmin/init.sh
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad   #
# Complutense de Madrid (dsa-research.org)                                   #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
# not use this file except in compliance with the License. You may obtain    #
# a copy of the License at                                                   #
#                                                                            #
# http://www.apache.org/licenses/LICENSE-2.0                                 #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an "AS IS" BASIS,          #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
#--------------------------------------------------------------------------- #

CHK_FILE="/var/lib/one/.done_context" 

/sbin/iptables -I INPUT -p icmp -j REJECT

if [ ! -e ${CHK_FILE} ]; then
    ## Random Password for root
#   dd if=/dev/urandom count=128 2>/dev/null | md5sum | passwd --stdin root

    MNT="/media/one" 

    if [ -f ${MNT}/context.sh ]; then
      . ${MNT}/context.sh
    fi

    fdisk /dev/xvdb << EOF
n
p
1

t
82
w
EOF
    if [ -b /dev/xvdb1 ]; then
        mkswap /dev/xvdb1
        echo "/dev/xvdb1 swap swap defaults 0 0" >> /etc/fstab
        swapon -a
    fi

    #hostname $HOSTNAME
    #sed -i "/HOSTNAME=/s/=.*$/=$HOSTNAME/" /etc/sysconfig/network

    #if [ -n "$IP_PUBLIC" ]; then
    #   ifconfig eth0 $IP_PUBLIC
    #fi

    #if [ -n "$NETMASK" ]; then
    #   ifconfig eth0 netmask $NETMASK
    #fi

    if [ -f ${MNT}/$ROOT_PUBKEY ]; then
        mkdir -p /root/.ssh
        cat ${MNT}/$ROOT_PUBKEY >> /root/.ssh/authorized_keys
        chmod -R 600 /root/.ssh/
    fi

    if [ -n "$USERNAME" ]; then
        useradd $USERNAME
        if [ -f ${MNT}/$USER_PUBKEY ]; then
            mkdir -p /home/$USERNAME/.ssh/
            cat ${MNT}/$USER_PUBKEY >> /home/$USERNAME/.ssh/authorized_keys
            chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
            chmod -R 600 /home/$USERNAME/.ssh/authorized_keys
        fi
    fi
fi

### Network Setup
if [ -f ${MNT}/setup-network.sh ]; then
    ${MNT}/setup-network.sh
fi

if [ ! -e ${CHK_FILE} ]; then
    ### Run Deploy
    if [ -f ${MNT}/deploy*/setup.sh ]; then
        ${MNT}/deploy*/setup.sh
    fi
fi

## Etc Jobs

### VMS init Setup END
/sbin/iptables -D INPUT -p icmp -j REJECT
# vi /home/oneadmin/setup-network.sh
#!/bin/bash
#
# chkconfig: 2345 10 90
# description:  network reconfigure
#                                                     
# -------------------------------------------------------------------------- #
# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad   #
# Complutense de Madrid (dsa-research.org)                                   #
#                                                                            #
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
# not use this file except in compliance with the License. You may obtain    #
# a copy of the License at                                                   #
#                                                                            #
# http://www.apache.org/licenses/LICENSE-2.0                                 #
#                                                                            #
# Unless required by applicable law or agreed to in writing, software        #
# distributed under the License is distributed on an "AS IS" BASIS,          #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
# See the License for the specific language governing permissions and        #
# limitations under the License.                                             #
#--------------------------------------------------------------------------- #

# Gets IP address from a given MAC
mac2ip() {
    mac=$1

    let ip_a=0x`echo $mac | cut -d: -f 3`
    let ip_b=0x`echo $mac | cut -d: -f 4`
    let ip_c=0x`echo $mac | cut -d: -f 5`
    let ip_d=0x`echo $mac | cut -d: -f 6`

    ip="$ip_a.$ip_b.$ip_c.$ip_d" 

    echo $ip
}

# Gets the network part of an IP
get_network() {
    IP=$1

    echo $IP | cut -d'.' -f1,2,3
}

get_interfaces() {
    IFCMD="/sbin/ifconfig -a" 

    $IFCMD | grep ^eth | sed 's/ *Link encap:Ethernet.*HWaddr /-/g'
}

get_dev() {
    echo $1 | cut -d'-' -f 1
}

get_mac() {
    echo $1 | cut -d'-' -f 2
}

gen_hosts() {
    NETWORK=$1
    echo "127.0.0.1 localhost" 
    for n in `seq -w 01 99`; do
        n2=`echo $n | sed 's/^0*//'`
        echo ${NETWORK}.$n2 cluster${n}
    done
}

gen_exports() {
    NETWORK=$1
    echo "/images ${NETWORK}.0/255.255.255.0(rw,async,no_subtree_check)" 
}

gen_hostname() {
    MAC=$1
    #NUM=`mac2ip $MAC | cut -d'.' -f4`
    NUM=`mac2ip $MAC`
    #NUM2=`echo 000000$NUM | sed 's/.*\(..\)/\1/'`
    #echo cluster$NUM2
    NUM2=`echo $NUM | sed 's/\./-/g'`
    echo $NUM2
}

gen_interface() {
 DEV_MAC=$1
 DEV=`get_dev $DEV_MAC`
 MAC=`get_mac $DEV_MAC`
 IP=`mac2ip $MAC`
 NETWORK=`get_network $IP`

cat <<EOT
DEVICE=$DEV
BOOTPROTO=none
HWADDR=$MAC
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=$IP
EOT

    if [ $DEV == "eth0" ]; then
      echo " GATEWAY=$NETWORK.1" 
    fi

echo "" 
}

IFACES=`get_interfaces`

for i in $IFACES; do
    DEV=`get_dev $i`
  gen_interface $i > /etc/sysconfig/network-scripts/ifcfg-${DEV}
done

# gen_hosts $NETWORK > /etc/hosts
# gen_exports $NETWORK  > /etc/exports
# gen_hostname $MAC  > /etc/hostname

#ifdown $DEV
#ifup $DEV

MNT="/media/one" 
if [ -f ${MNT}/context.sh ]; then
  . ${MNT}/context.sh
fi

HOSTNAME=ONE-${VMID}-`gen_hostname $MAC`

hostname $HOSTNAME
sed -i "/HOSTNAME=/s/=.*$/=$HOSTNAME/" /etc/sysconfig/network

if [ -n "$DNS" ]; then
    for dns in $DNS
    do
        echo "nameserver $dns" > /etc/resolv.conf
    done
else
    echo "nameserver 168.126.63.1
nameserver 168.126.63.2" > /etc/resolv.conf
fi

service network restart

Creating VM and Connect SSH

Create VM

# onevm create /home/oneadmin/template.vm.centos5_64

..... wait a minute...

# onevm list
   ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME
   37 oneadmin   one-37 runn   0    256M          one-02 07 04:40:21
# onevm show 37
VIRTUAL MACHINE 37 INFORMATION                                                  
ID             : 37                  
NAME           : one-37              
STATE          : ACTIVE              
LCM_STATE      : RUNNING             
START TIME     : 07/24 18:38:40      
END TIME       : -                   
DEPLOY ID:     : one-37              

VIRTUAL MACHINE MONITORING                                                      
NET_RX         : 11                  
USED MEMORY    : 262144              
USED CPU       : 0                   
NET_TX         : 6887                

VIRTUAL MACHINE TEMPLATE                                                        
CONTEXT=[
  FILES=/home/oneadmin/init.sh /home/oneadmin/.ssh/id_rsa.pub /home/oneadmin/setup-network.sh,
  ROOT_PUBKEY=id_rsa.pub,
  TARGET=xvdc,
  VMID=37 ]
CPU=1
DISK=[
  CLONE=YES,
  DISK_ID=0,
  IMAGE=Xen-CentOS5_64,
  IMAGE_ID=2,
  READONLY=NO,
  SAVE=NO,
  SOURCE=/var/lib/one//images/334f3324668b29bd253c7d304e499576ede0b611,
  TARGET=xvda,
  TYPE=DISK ]
DISK=[
  DISK_ID=1,
  SIZE=1024,
  TARGET=xvdb,
  TYPE=swap ]
DISK=[
  DISK_ID=2,
  FORMAT=ext3,
  SIZE=20480,
  TARGET=xvdd,
  TYPE=fs ]
GRAPHICS=[
  LISTEN=127.0.0.1,
  PORT=5937,
  TYPE=vnc ]
MEMORY=256
NAME=one-37
NIC=[
  BRIDGE=xenbr0,
  IP=192.168.100.154,
  MAC=02:00:c0:a8:64:9a,
  NETWORK=Public,
  NETWORK_ID=1 ]
OS=[
  BOOTLOADER=/usr/bin/pygrub ]
VMID=37

Connect to VM's SSH

# ssh -i /home/oneadmin/.ssh/id_rsa root@192.168.100.154
Warning: Permanently added '192.168.100.154' (RSA) to the list of known hosts.
Last login: Sun Jul 31 22:35:14 2011 from 192.168.100.121
[root@ONE-37-192-168-100-154 ~]#

Some Info on VM

[root@ONE-37-192-168-100-154 ~]# cat /proc/cpuinfo 
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 23
model name    : Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz
stepping    : 10
cpu MHz        : 2826.250
cache size    : 6144 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu tsc msr pae cx8 apic cmov pat clflush acpi mmx fxsr sse sse2 ss syscall nx lm constant_tsc pni ssse3 cx16 sse4_1 lahf_lm
bogomips    : 7097.80
clflush size    : 64
cache_alignment    : 64
address sizes    : 40 bits physical, 48 bits virtual
power management:

[root@ONE-37-192-168-100-154 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           256        252          3          0         45        145
-/+ buffers/cache:         61        194
Swap:         1019          0       1019

[root@ONE-37-192-168-100-154 ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 02:00:C0:A8:64:9A  
          inet addr:192.168.100.154  Bcast:192.168.100.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:50726 errors:0 dropped:0 overruns:0 frame:0
          TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7059149 (6.7 MiB)  TX bytes:17642 (17.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:700 (700.0 b)  TX bytes:700 (700.0 b)

[root@ONE-37-192-168-100-154 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 eth0

[root@ONE-37-192-168-100-154 ~]# fdisk -l

Disk /dev/xvda: 1572 MB, 1572864000 bytes
255 heads, 63 sectors/track, 191 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          13      104391   83  Linux
/dev/xvda2              14         191     1429785   83  Linux

Disk /dev/xvdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1         130     1044193+  82  Linux swap / Solaris

Disk /dev/xvdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdd doesn't contain a valid partition table

Disk /dev/xvdc: 0 MB, 382976 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdc doesn't contain a valid partition table

[root@ONE-37-192-168-100-154 ~]# mount
/dev/xvda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/xvda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/xvdd on /mnt type ext3 (rw)

[root@ONE-37-192-168-100-154 ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/xvda2    ext3    1.4G  995M  289M  78% /
/dev/xvda1    ext3     99M   14M   81M  14% /boot
tmpfs        tmpfs    128M     0  128M   0% /dev/shm

[END]

Posted by 사랑줍는거지
,

 http://redmine.nehome.net/redmine/projects/cloudstack/wiki/Install_-_CloudStack_CE_21x_ManagementComputing_Node 



[Management Server(CentOS 5.x)]
(JDK install/setting)

hostname is FQDN
Edit /etc/hosts : All node
Setup DNS Server (Option) 
yum -y install mysql-server
sed -i '/^[mysqld]/a innodb_lock_wait_timeout=600' /etc/my.cnf
sed -i '/^[mysqld]/a innodb_rollback_on_timeout=1' /etc/my.cnf
service mysqld start
chkconfig mysqld on
mysqladmin -uroot password '1234'
wget http://download.cloud.com/foss/centos/cloud.repo -O /etc/yum.repos.d/cloud.repo
yum clean all
yum -y install cloud-console-proxy
yum -y install cloud-client
cloud-setup-databases cloud:1234@localhost kvm --deploy-as=root:1234
virsh net-destroy default
rm -f /etc/libvirt/qemu/networks/default.xml
service dnsmasq stop
service libvirtd stop
chkconfig dnsmasq off
chkconfig libvirtd off
cloud-setup-management
reboot

----------------

[Computing Nnode]

wget http://download.cloud.com/foss/centos/cloud.repo -O /etc/yum.repos.d/cloud.repo
yum clean all
yum -y install cloud-agent
cloud-setup-agent
cloud-setup-agent --no-kvm (not use kvm module)
virsh net-destroy default
rm -f /etc/libvirt/qemu/networks/default.xml
(on CentOS)
#iptables -I INPUT -i cloud0 -j ACCEPT  
#iptables -I FORWARD -i cloud0 -o cloud0 -j ACCEPT  
#iptables -I FORWARD -i cloudbr0 -o cloudbr0 -j ACCEPT 
#iptables -I INPUT -m tcp -p tcp --dport 5900:6100 ?j ACCEPT 
(on Fedora)
#iptables -I FORWARD -i cloudbr0 -o cloudbr0 -j ACCEPT 
#iptables -I INPUT -m tcp -p tcp --dport 5900:6100 ?j ACCEPT
service iptables save
reboot

'Cloud' 카테고리의 다른 글

CloudStack + SDN  (0) 2012.05.01
Install OpenNebula-2.2-1 with Xen  (0) 2012.03.18
CloudStack 2.2.13 with XenServer (on ESXi)  (0) 2012.02.25
정말 AWS가 클라우드의 표준(Standard)은 아니잖아~  (0) 2012.02.07
Cloud.... 'Beta'는 없다.  (0) 2012.02.04
Posted by 사랑줍는거지
,
CloudStack 2.2.13 가상화 기반에서 테스트 가능하네요... 물론 KVM은 불가... XenServer를 사용한다면 HVM이 필요 없음에도, CloudStack은 HVM을 기본으로 체크해서 Computing Node 등록이 불가했었는데, 이걸 페이크 처리 하는 팁이 CloudStack Knowledge Base에 공개되었네요.. Citrix가 인수 하다보니 그런건지... 작년에 이부분때문에 한동안 이슈가 많이 올라오던데 별 진전이 없더만.... MySQL DB의 configuration테이블에 Advanced 속성 하나를 수작업으로 만들어 주니 되는군요... VMware ESXi에서 확인 했습니다~ 설치 문서는 기존 2.2 퀵인스톨 PDF 대충 참조.....
http://docs.cloud.com/Knowledge_Base/How_to_use_CloudStack_without_Hardware_Virtualization
물리 인프라 때문에 이것저것 테스트에 제약이 많았는데~ 이제 맘놓고 Advanced Networking도 실컷 내맘대로 테스트 해볼 수 있을듯~ 야호~
Posted by 사랑줍는거지
,

Introduction

Puppet is a Ruby based Configuration Management System with client/server model,  licensed under GPLv2 .It has one Master server puppetmasterd  and all other machines are configured as puppet clients . We set configurations at the puppet server and then push them to all clients which are connected to the master. The client puppet correctly applies the corresponding configurations on the client machine regardless of their platform difference.

Puppet is a gift to the server administrators who need to manage a large number of systems with different flavor of Gnu/Linux, Mac, Solaris and other Unix Based systems.If we are managing systems via remote administration then it would be a headache to the administrator and if the systems are different then the complexity will increase. Some accidental configuration changes may cause inconsistent working of the server. If we are using the Puppet for the configuration management then it will be a one time implementation of these configuration changes only at puppet server, then we just apply them to different puppet clients without any delay.

Another power of the puppet is it uses a Declarative Language to define configuration settings at the puppet master server. This language includes all major high level language features like Functions, Conditional Statements, Inheritance and other OOPs concepts. This feature makes for more readable , reusable and consistent Puppet configurations settings, when we compared with other configuration management tools like Cfengine.

Working

Puppet master server stores all client configurations, and  each client will contact the server via port 8140 (by default). The connection between server and client is encrypted. The client will generate a self-signed key before it connects to server and will submit this self-signed key to the master server and get the verified key back. Here master server acts like a Certification Authority. After this process, the client will establish a encrypted session with the server and get the configuration settings, then compile and apply it on client system. When the client compiles the configurations from server it may rise error messages if  there are any syntax errors in the configuration definitions. We can verify this on the puppet server and client log file.

Here is the outline of puppet server and client Architecture

Puppet Architecture

Puppet Architecture

Installation

Before installing Puppet, we need to setup some dependencies. First we need ruby with common library files(xml,ssl,etc.) installed, and facter, which is another ruby project that gathers all system information. Facter will be installed in all puppet clients. The puppet server retrieves the client configuration settings and other system-specific details from facter.

You can use the ruby’s built-in library management tool rubygem(rake) (similar to CPAN for Perl) to solve the dependency problems with libraries.

Facter installation :-

Get latest version from www.reductivelabs.com

1 tar -zvf facter-<version>.tar.gz
2  
3 cd facter
4  
5 ruby install.rb
6  
7 facter --version

Puppet installation :-

If we are installing from the package manager, there will be two packages: puppetd as the client and puppet-master as the Puppet server. We need to install both to setup the client and server, and both can be installed from the source code.

Download latest package from the www.puppetlabs.com, then similar to facter installation:

1 tar -xzvf puppet-<latest version>;
2  
3 cd puppet-<latest-version>;
4  
5 ruby install.rb
6  
7 #Create user and group for puppet
8 groupadd puppet
9 useradd -g puppet puppet

This step will install the required packages for the Puppet client and server. If you have any dependency problems then it might be due to a version mismatch problem between ruby/puppet/facter, so select correct the versions.

By default, the configuration files are listed under /etc/puppet and all others are in the /var/lib/puppet  folder (including log files).

Currently Puppet support all major Unix like systems but not Windows.The latest versions of the Puppet has introduced support for the Windows operating system by developing Windows specificfacter tool.

How to configure Puppet server :-

After  successful installation of the Puppet master server and client, there is a set of daemons associate with this package as well as command line utilities to manage these daemons. They are:

1 puppetmasted       #Puppet Master Server
2  
3 puppetd            #puppet Client.
4  
5 puppetca           #Key management daemon
6  
7 #and Set of other Utility commands.

Puppet  work without creating configuration files explicitly; they are already pre-configured. But to start the interaction with clients we need to make some changes. First, we can check the structure of the puppet configuration file.

It’s a good practice maintaining an explicit puppet configuration file;the latest versions of puppet use single configuration file to manage every daemons. By default, configuration files are stored under /etc/puppet. We save  all the configuration details of major daemons at /etc/puppet/puppet.conf.The puppet.conf use a special type of configuration structure to include every daemon’s configuration details,described below:

01 #Cat /etc/puppet/puppet.conf
02  
03 [main]
04  
05 Here We specify a set of configuration details common to all daemons.
06  
07 [puppetmasterd]
08  
09 Here comes the Puppet master server configuration details.
10  
11 [puppetd]
12  
13 To include the Puppet client configurations.
14  
15 [puppetca]
16  
17 Configuration details of puppet key management tool.

To get all the parameters under each daemons and main section with its functional details, please refer this page

How to Connect Puppet Client with Puppet Server

To set up a client we  just have to install the puppet client version or every package in another system.Your master server is now capable to work as a puppet client also. At the master server we need to specify the set of configuration that will guide how to change the configurations at clients.

Puppet server and client use Hostname to communicate with each other and also used to generate ssh key and key verification etc.., so we need a stable hostname resolution system (DNS or Local settings) in our network to ensure the proper connection between clients and server.So select proper hostnames to your server and clients like:

puppet-server.com #For your Master Server

puppet-client1.com,puppet-client2.com,etc... #Your clients.

After the hostname allocation we need to start the server and client daemons.Use command line options now to know the more about the interactions between client and server.

To start the master server :-

1 puppetmasterd --no-daemonize --logdest console

Then Start the puppet Client, specify the server name

1 puppetd --server puppet-server.com --verbose --waitforcert 30

On the client side we will get the message regarding the creation of a self signed key and waiting for server verification.

1 Creating a new SSL key for puppet-client.com
2 Creating a new SSL certificate request for puppet-client.com
3 Certificate Request fingerprint (md5): 37:89:4E:86:C0:A7:5B:24:1A:E2:9B:85:83:90:0F:CE
4 Did not receive certificate

At the same time server side we will get the following message.

1 notice: Starting Puppet master version 2.6.0
2 notice: puppet-client.com has a waiting certificate request

To proceed further , at server side we need to verify this key from the puppet-client.com. For that we can use the key management tool puppetca.

1 puppetca --list  #To list the unverified requests.
2  
3 puppetca --sign puppet-client.com  # To complete the verification process.

Now If we are restarting the puppet client with following command, you can see the client will immediately apply the configurations. You can check this from the log file or from the console if you are running the client in none daemonize mode.

1 puppetd --server puppet-server.com

Note:- If we are specify these settings at puppet.conf then you can just type the commands without any parameters to start appropriate daemons.

The Configuration Management

Last and very powerful feature of the puppet is the way Puppet server define the Client configurations. For that Puppet use one declarative language which support most of the high level language constructs like OOPs. So lets try one simple configuration which change the permission of /etc/passwd file at all the clients connected with server to 640 and check Apache webserver installed or not , if not, puppet client will install it automatically.

These configuration specifications are defined under a file “/etc/puppet/manifests/site.pp” by default, we can split this file in to several files then include them at sites.pp.

Here is the sample site.pp file.

01 file { "password":
02 name => "/etc/passwd",
03  owner => "root",
04  group => "bin",
05  mode => 644,
06 }
07  
08 class apache {
09  
10 package {       httpd: ensure => installed  }
11  
12 service { "httpd":
13  
14 name => $operatingsystem ? {
15 debian  => "apache2",
16 redhat  => "httpd",
17 default => "apache",
18 CentOS  => "httpd",
19 },
20 ensure => running,
21 require => Package["httpd"],
22 }
23 }
24  
25 node 'puppet-client.com' {
26 include apache
27 }
28 #All other nodes they don't have definitions associated with them will use the following node definition.
29  
30 node default {
31 case $operatingsystem {
32 CentOS: {include apache }
33 default: {}
34 }
35 }

The above file is the Puppet client configuration specification written in puppet declarative language on puppet master server.

This language has a lot of constructs to define the resource and its properties.Using these constructs we manage the resources on client systems. The types of resources that puppet manages are listed bellow, plus we can add our own customized resources to mange.

Type of Resources that puppet can manage, by default:-

  • Files
  • Packages
  • Services
  • Corn Jobs
  • Users and Groups
  • To run Shell Commands
  • And User defined resource types

Each of the above resources has a set of attributes or properties and values. Using the puppet configuration language, we can set the corresponding property values. The resource can defined by providing three main parameters: Resource type name, then inside braces({}) title of the resource and set of property values. From the above example, take the resource of type Filewith title name “password” inside that we have set of property values like name,owner,groups etc… so if a client successfully connect to server,the client puppet will apply these setting on client machine. If we change this property values, after next interval we can see the client will successfully apply it.

In this way we can control the resource configurations. On our networks there should be  different types of systems (Redhat,Debian,etc..),and they have some changes in the structure of the files and other package names, so here we need to apply the configurations based on the type of clients.Puppet provide Conditional statements (if and case ) to check and apply configurations depending on client architecture. For that we need some system information from the client andfacter will provide these details. We can use that information in the puppet configuration specifications like a variable, for example: $operatingsystem (You can see all the details that facter will provide by just typing the command facter at command prompt.)

Similarly, we can specify the rules based on the client name, and using the OPPs constructs we can define the classes and reuse them with other client definitions. You can find some of them from  above example site.pp file.You can do a high level configuration design using puppet language. To learn more about the language constructs, please check the puppet online wiki or a nice book  which describe everything associated with Puppet by James Turnbull(Pulling Strings with Puppet.)

Posted by 사랑줍는거지
,
1. 메모리에서(in-memory) 처리하기 어렵다.
2. 디스크가 매우 느리다.
3. 분산이 쉽지 않다. 
Posted by 사랑줍는거지
,

Partition tolerance refers to the ability for a system to continue to operate in the presence of a network partitions.  For example, if I have a database running on 80 nodes across 2 racks and the interconnect between the racks is lost, my database is now partitioned.  If the system is tolerant of it, then the database will still be able to perform read and write operations while partitioned.  If not, often times the cluster is completely unusable or is read-only.



Consistency : all nodes see the same data at the same time
Availability : node failures do not prevent survivors from continuing to operate
Partition Tolerance : the system continues to operate despite arbitrary message loss


Posted by 사랑줍는거지
,
  우선 금번 포스팅은 지극히 개인적인 생각이다. 나만의 시각일 뿐임... 특히 MR같은 특수한 기능 측면 보다는 기존 RDB에 비춰 NoSQL의 일반적 특성이 뭘까 고민 해본 정도??

  작년엔 IaaS로 후끈~ 달아 오르더니 딱 1년 지나니... 조용.......... 뭔가 모든걸 해결해 줄듯~ 기세등등한 "Oral-Clouder"들의 천국(전부가 다 그렇단 이야긴 아니니 오해 없길...)이었던 것 같다... 한 1년 겪어보니 이게 장난이 아니구나~ 싶었던걸까...... 그러던 "IT깡국 대한민국"이... 올해는NoSQL, Big-Data로 난리도 아닐것 같다... 뭐가 됐든, 붐이 이는건 좋다... 다만, 걱정되는건 작년 IaaS 처럼... 반짝~ 하고 말게 되지나 않을까 하는거.....

  NoSQL의 개념이나, 등장 하게된 배경...등은 위키피디아를 참고 하시고... 여기서 하고 싶은 이야기는 그것의 본질적 목적이 무엇인가~에 대한 것이다...

 
  같은 값이면 다홍치마~ 라고 했던가? NoSQL이면서, RDB의 기능을 커버할 수 있다면 오죽 좋으련만... 세상에 겁나 싸면서, 기름 열라 작게 먹고, 그런데 승차감은 죽이는데, 속도는 마하급.. 그리고 실내는 버스만큼 넓은~ 그런차는... 몰라 훗날엔 존재할지도 모르겠지만, 당장은 절대로 없다... 무슨 말이냐... RDB의 특징을 유지하면서는, 대용량(기존의 전통적 시스템으로 커버 불가능한 용량) 서비스가 불가능 하기에, 일정 부분 불편함이나, 기능 포기를 감수하고서라도 그러한 대용량 서비스에 대해 탄력적으로 대응이 가능하고 원활한 서비스가 가능케 할 수 있는 방법이 뭘까~ 고민, 고민 하다 나온게(어쩌면 울며 겨자먹기식 차선책일지도 모른다) NoSQL 아닐까.. 싶다.

급조된(?) 아래 그림을 보자...


  가로축은 서비스 이용자 규모다.... 가운데 즈음의 회색 점선을 기준으로 과거 RDB가 커버 가능한 사용자 규모와, 불가능한 규모를 가정하여 잘라둔것...
  세로축은 성능이다... 단, 이 "성능"이라는 말에는 퍼포먼스 뿐만이 아니라, 기능, 그외 사용자가 느끼는 모든 것들을 포괄한 넓은 개념의 그 무엇이라고 보면된다... 그게 일관성이든, 트랜잭션이든, 응답성이든, 기능이든 뭐든...

   다음으로, 파란선은 기존의 RDB를 가정하여 그린 곡선이다. 과거의 전통적인 시스템에서는 하이엔드급 단일 시스템 또는 역할이 분리된 서버군으로 처리가 가능하였다.. 그러나 사용자수가 일정규모를 넘어서는 시점(요즘 말하는 대용량..)부터는 성능이 급감하게 된다... 소위 동적 수평 확장이 어려워 증가하는 사용자 규모에 대해 탄력적 대응이 어렵다..

  반면 빨간선 그래프는 요즘 뜨고 있는 NoSQL이라 생각하고 그려 본 것이다.. 딱 보면, 성능이 사용자 규모의 증가에 적절히 대처 하고 있을 것이라 예상되어 저렇게 그렸던 것이다... 왜? 동적 수평 확장이 가능하기에... 뭐 어디까지나 이론적이지만,,, 아쉽게도 수백대의 NoSQL로 그러한 규모의 사용자에 대한 서비스 처리를 직접 경험해본 적은 없다... 

  여기까진 개략적인 설명이고, 이 그림에서 주목할 부분은 왼쪽의 그래프 시작부분의 빨간선과 파란선의 초기 "성능"값이 다르다는 것이다. 즉, RDB가 NoSQL에 비해, 성능(사용자가 느끼는 모든 부분의...)에서는 월등하다.. 그게 편리함이건, 퍼포먼스건 뭐건... 이 부분에서 사람들이 착각하기 쉬운게 아닐까? 그런 손해를 감수 하고서라도, 그래프의 오른쪽의 대규모 사용자 영역에서 빛을 발하도록 고안된게 NoSQL일 것이다.

  그런 NoSQL을 왼쪽, 다시 말해 전통적인 규모에서 RDB의 기능들을 어설프게 따라 가려 하다가는, 진짜 자기 영역인 오른쪽 영역에서 RDB만도 못한 기대치를 보여줄 가능성이 매우 높을 것이라는 것이다...

  앞서도 언급했지만, "같은 값이면 다홍치마"면 얼마나 좋으려나~ 그러나 절대로 RDB와 NoSQL이 같은 "값"이 아니다.. 그 목적하는 바와 규모, 용도가 전혀 다르다...적어도 현재는... 수년이 지나면 RDB가 NoSQL의 장점을 일부 흡수하게되고(지금도 그런 움직임이 오라클이나, MySQL쪽에서 일고 있다..), NoSQL도 허용가능한 범위에서 RDB의 편리한 점은 흡수하려 할것이다.. 그러나 태생적으로 그 둘 모두의 장점을 결합한 그 무엇은 단기간 내에 보기는 힘들 것이다...

  저 그래프가 시간이 지났을 때를 예측한다면, RDB 입장에선 성능이 급감하는 시점(사용자 규모)을 더 오른쪽으로 최대한 옮길려고 할테고, 그에 대항해 NoSQL은 전체적인 성능을 올리는, 즉 그래프를 조금씩이라도 위쪽으로 옮기려 할 것이다... 뭐 NoSQL이나 Big-Data보다는 Virtualization에 훨씬 관심이 많지만, 이 분야도 앞으로 어떻게 전개될지 흥미는 있을것 같다...


Posted by 사랑줍는거지
,
정말 궁금하다... AWS가 클라우드의 표준일까?? SKT클라우드 기사 검색하면서 다시 느낀게... "S3 100%호환 스토리지~ 어쩌고~ 블라블라~~"..... AWS는 충분히 훌륭한 레퍼런스이고 독보적임은 분명하다. 그러나 호환은 옵셔널 한 것일뿐이다. 단지 그게 전부고 그기에 의존적이라는 건....... 최근의 DynamoDB의 출현만 봐도 그렇다. 결과론적이지만, SimpleDB는 DynamoDB의 전신? 테스트베드? 그정도가 된게 아닌가? 이런 상황에서의 오버헤드는 어떻게 할 것인지... 휘둘릴 수 밖에 없지 않나... 대한민국IT의 창의성이 부족한건 아닌거 같다...어떤 민족인데... 단지, 당장에 뭐라도 안하면 뒤쳐지는 것만 같아 조급해하고 있는 것 같다.... SKT클라우드 기사 내용도 참~... 지금으로선 딱히 내세울게 없었던지... 10g광케이블, 냉각시스템, 센터 평수, 전기요금.. 뭐 그런 식상한 내용들이 9할... 아무리 시작단계지만.. 중요한 먼가가 퍽~ 하고 빠져 있다는 느낌?? 뭐 마침 기사 검색하다 본내용이라 SKT가 언급했지만... 다른곳도 50보100보 같다... 비관은 아니다... 현재를 좀 냉정히 볼필요는 있을것 같다... 물론 틀린 판단일 수도 있다... 뭣도 모르는 놈이라~ 이런 저런 공상을 해보는 것일뿐...

SKT 기사 링크 : 
http://www.kbench.com/digital/?no=106196&sc=1 
[케이벤치-SK텔레콤, 국내 최고 수준 B2B 클라우드 서비스 개시] 
Posted by 사랑줍는거지
,