Version 21 (modified by rock, 16 years ago) (diff) |
---|
叢集
1.佈署成Cluster
- 可使用 DRBL 或 CloneZilla 來佈署 Cluster
- 此次為了方便,可直接使用隔壁桌的電腦
2.第二台機器的設定
- 更改第二台主機名稱 node02
$ sudo vim /etc/hostname $ sudo hostname -F /etc/hostname CTRL + D $ sudo /etc/init.d/gdm restart
- 重複單機的 0 ~ 4 步驟
- 確認 node01 和 node02 的 /etc/hosts 有 node01 和 node02 的資訊
$ sudo vim /etc/hosts 192.168.X.X node01 192.168.X.X node02
- 設定兩台的 ssh auto login,讓 root 可以不需打密碼登入 node01 和 node02
### 在 node01 上執行 ### $ 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-> NFS server, node02-> NFS client)
### node01 的設定 (192.X.X.X 為 node02 IP) ### $ sudo aptitude install nfs-kernel-server $ vim /etc/exports /home/domains 192.X.X.X(rw,sync) /home/one 192.X.X.X(rw,sync) $ /etc/init.d/nfs-kernel-server start $ showmount -a ### 切換到 node02 去掛載 nfs ### $ 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
- 3.2 下載 ONE 和安裝
$ wget http://opennebula.org/files/one-1.2.0.tar.gz $ 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 start
4.使用 ONE 於 Xen Cluster
- 4.0 編輯 ONE 設定檔
$ cd /home/one $ vim etc/oned.conf VM_POLLING_INTERVAL = 1 #TM_MAD = [ #name = "tm_ssh", #executable = "one_tm", #arguments = "tm_ssh/tm_ssh.conf", #default = "tm_ssh/tm_ssh.conf" ] TM_MAD = [ name = "tm_nfs", executable = "one_tm", arguments = "tm_ssh/tm_nfs.conf", default = "tm_ssh/tm_nfs.conf" ]
- 4.1 新增 node01 和 node02 到 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
6.測試 Migration
- 6.1 Migrate
$ cd /home/domains $ onevm create xen01.one $ onevm list ### 本範例預設 xen01 已經跑在 node01,再將其 Migrate 到 node02 ### $ onevm migrate xen01 node02 $ onevm list
- 6.2 Live Migrate
$ onevm list $ onevm livemigrate xen01 node01 $ onevm list
Attachments (2)
- ONE_demo.png (22.4 KB) - added by rock 16 years ago.
- ONE_demo_2.png (11.8 KB) - added by rock 16 years ago.
Download all attachments as: .zip