= 叢集 = == 1.佈署成Cluster == 1. 可使用 DRBL 或 !CloneZilla 來佈署 Cluster 2. 此次為了方便,可直接使用隔壁桌的電腦 ---- == 2.第二台機器的設定 == * 更改第二台主機名稱 node02 {{{ $ sudo vim /etc/hostname $ sudo hostname -f /etc/hostname CTRL + D $ sudo /etc/init.d/gdm restart }}} * 重複單機的 0 ~ 4 步驟 * 確認 /etc/hosts 有彼此的資訊 {{{ // node01 和 node02 的 /etc/hosts $ sudo vim /etc/hosts 192.168.X.X node01 192.168.X.X node02 }}} * 設定兩台的 auto login {{{ $ su root $ ssh-keygen -P "" $ cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys $ scp -r ~/.ssh node02:~/ $ ssh node02 $ ssh node01 CTRL + D CTRL + D }}} * 設定共享的 Storage {{{ // node01 的設定 $ vim /etc/export /home/domains 192.X.X.X(rw,sync,async,no_root_squash,no_subtree_check) /home/one 192.X.X.X(rw,sync,async,no_root_squash,no_subtree_check) $ /etc/init.d/nfs-kernel-server start $ showmount -a // node02 的設定 $ sudo mount.nfs node01@/home/domains /home/domains $ sudo mount.nfs node01@/home/one /home/one $ mount }}} ---- == 3.安裝 ONE == * '''''__3.1 安裝需要的套件__''''' {{{ $ sudo aptitude install ruby sqlite3 libsqlite3-0 libsqlite3-dev libsqlite3-ruby \ libxmlrpc-c3 libxmlrpc-c3-dev scons g++ flex bison }}} * '''''__[http://www.opennebula.org/doku.php?id=software 3.2 下載 ONE 和安裝]__''''' {{{ $ tar zxvf one-1.2.0.tar.gz $ cd one-1.2.0 $ scons $ sudo mkdir /home/one // 配置 ONE 環境變數 $ vim ~/.bashrc export ONE_LOCATION=/home/one export ONE_XMLRPC=http://localhost:2633/RPC2 export PATH=$PATH:$ONE_LOCATION/bin $ source ~/.bashrc $ sudo ./install.sh -d /home/one }}} * '''''__3.3 啟動 ONE__''''' {{{ $ $ONE_LOCATION/bin/one start }}} ---- == 4.使用 ONE 於 Xen Cluster == * '''''__4.0 編輯 ONE 設定檔__''''' {{{ $ cd /home/one $ vim etc/oned.conf VM_POLLING_INTERVAL = 1 }}} * '''''__4.1 新增 Host/dom0 到 ONE pool__''''' {{{ $ onehost add node01 im_xen vmm_xen tm_nfs $ onehost add node02 im_xen vmm_xen tm_nfs $ sudo onehost list }}} * '''''__4.1 使用 ONE 來開啟 VM__''''' {{{ $ vim /home/domains/xen01.one NAME = xen01 CPU = 1 MEMORY = 156 OS = [ kernel = /boot/vmlinuz-2.6.22.9-rock, initrd = /boot/initrd.img-2.6.22.9-rock, root = sda2, kernel_cmd = "ro xencons=tty console=tty1"] DISK = [ source = /home/domains/xen01/disk.img, clone = no, target = sda2, readonly = no] DISK = [ type = swap, size = 512, target = "sda1", readonly = "no" ] NIC = [mac=""] $ sudo onevm create xen01.one $ sudo onevm deploy xen01 node02 $ sudo onevm list }}} * 練習:請在開啟一個虛擬機器名為 xen02 * 法一:複製 xen01 的 image,再修改參數 * 法二:使用 xen-create-image 指令 ---- == 5.使用 ONE 開啟 Hadoop Cluster == {{{ $ cd /home/hadoop $ ./prepare.sh $ cd /home/domains $ ./one_creatre_hadoop_cluster.sh $ onevm list }}} * [https://trac.nchc.org.tw/cloud/wiki/NCHCCloudCourse090331 馬上報名雲端運算基礎課程 ] ---- == 6.測試 Migration == * '''''__6.1 Migrate__''''' {{{ $ sudo onevm migrate xen01 node02 $ sudo onevm list }}} * '''''__6.2 Live Migrate__''''' {{{ $ sudo onevm livemigrate xen01 node02 $ sudo onevm list }}}