Ubuntu Enterprise Cloud: Instalasi UEC

From OnnoWiki
Jump to navigation Jump to search

Objectif

Dalam tutorial ini kita akan belajar bagaimana cara menginstalasi, mengkonfigur, mendaftarkan dan melakukan beberapa operasi pada setup UEC dasar yang mudah-mudahan akan menghasilkan sebuah controller "front-end" dan satu atau lebih node yang menjalankan Virtual Machine (VM) instances. kita akan menggunakan beberapa contoh untuk membantu kita dapat membuat sendiri private compute cloud.


Download

  • Download iso Ubuntu Server dari
http://www.ubuntu.com/server/get-ubuntu/download


STEP 1: Persyaratan

Untuk menjalankan sebuah infrastruktur cloud minimal, kita akan membutuhkan paling tidak dua (2) sistem dedicated.

  • sebuah front end.
  • sebuah atau lebih node.

Berikut ini adalah rekomendasi spec.


Front End

Gunakan tabel berikut untuk sebuah sistem yang akan menjalankan satu atau lebih:

  • cloud controller (clc)
  • cluster controller (cc)
  • walrus (S3-like storage service)
  • storage controller (sc)
Hardware Minimum Suggested Notes
CPU 1GHz 2 x 2GHz for an all-in-one front end, it helps to have at least a dual core processor
Memory 2GB 4GB the Java web front end benefits from lots of available memory
Disk 5400rpm IDE 7200rpm SATA slower disks will work, but will yield much longer instance startup times
Disk Space 40GB 200GB 40GB is only enough space for only a single image, cache, etc., Eucalyptus does not like to run out of disk space
Networking 100Mbps 1000Mbps machine images are hundreds of MB, and need to be copied over the network to nodes


Node(s)

Untuk sistem yang berupa node, yang akan menjalankan:

  • node controller (nc)

Sistem ini yang akan menjalankan instances. Anda akan membutuhkan satu atau lebih sistem dengan

Hardware Minimum Suggested Notes
CPU VT extensions VT, 64-bit, Multicore 64-bit can run both i386, and amd64 instances; by default, Eucalyptus will only run 1 VM per CPU core on a Node
Memory 1GB 4GB additional memory means more, and larger guests
Disk 5400rpm IDE 7200rpm SATA or SCSI Eucalyptus nodes are disk-intensive; I/O wait will likely be the performance bottleneck
Disk Space 40GB 100GB images will be cached locally, Eucalyptus does not like to run out of disk space
Networking 100Mbps 1000Mbps machine images are hundreds of MB, and need to be copied over the network to nodes

STEP 2: Install Cloud/Cluster/Storage/Walrus Front End Server

  • Download 10.04 atau 10.10 Server ISO
  • Ubuntu 10.04 - Pada saat booting, pilih “Install Ubuntu Enterprise Cloud”.
Bootscreen.png
  • Ubuntu 10.10 - Pada saat booting, ketik cloud.
  • Installer akan mendeteksi jika ada komponen Eucalyptus lain di jaringan.
Uec1.png
  • Kita dapat memilih komponen mana yang akan di install, tergantung topologi yang kita pilih.
Uec2.png
  • Installer akan menanyakan dua (2) pertanyaan yang spesifik untuk cloud pada saat instalasi, yaitu:
    • Nama dari cluster kita, misalnya, cluster1.
Uec3.png
    • Range dari IP address LAN yang akan di alokasikan oleh cloud ada instances, misalnya, 192.168.1.200-192.168.1.249.
Uec4.png

STEP 3: Install Node Controller

Instalasi node controller lebih sederhana. Pastikan bahwa kita tersambung ke jaringan dimana cloud/cluster controller sudah running.

  1. Boot menggunakan ISO yang sama untuk node.
  2. Pilih “Install Ubuntu Enterprise Cloud”
  3. Installer harusnya mendeteksi Cluster dan preselect “Node” install untuk kita
  4. Konfirmasikan partisi harddisk
  5. Proses instalasi selanjutnya harus dilakukan tanpa berhenti; selesai sudah proses instalasi dan reboot node.

STEP 4: Proses Registrasi Node

Semenjak Ubuntu 10.04 LTS, semua registrasi komponen harusnya berlangsung secara automatis, dengan asumsi:

  1. Public SSH key dapat di pertukarkan dengan benar.
  2. Layanan / service dapat di konfigasi dengan benar.
  3. Layanan / service mempublikasikan keberadaannya di jaringan
  4. uec-component-listener yang benar berjalan
  5. Melakukan verifikasi registrasi.

Langkah ini hanya di perlukan kalau kita menggunakan langkah / metoda UEC/PackageInstall. Jika kita menggunakan langkah Ubuntu Enterprise Cloud: Instalasi UEC semua langkah ini biasanya sudah dilakukan secara automatis, kita tidak perlu melakukan langkah ini lagi.

Pertukaran Public SSH Key

Eucalyptus user Cloud Controller membutuhkan akses SSH ke Walrus Controller, Cluster Controller, dan Storage Controller sebagai eucalyptus user.

Install Cloud Controller eucalyptus user public ssh key dengan cara:

  • Di target controller, set password sementara untuk eucalyptus user:
sudo passwd eucalyptus
  • Kemudian pada Cloud Controller:
sudo -u eucalyptus ssh-copy-id -i /var/lib/eucalyptus/.ssh/id_rsa.pub eucalyptus@<IP_OF_NODE>
  • Selanjutnya kita dapat membuang password eucalyptus account di target controller, jika kita inginkan:
sudo passwd -d eucalyptus


Konfigurasi Layanan / Service

Pada Cloud Controller:

  • Untuk Registrasi Cluster Controller:
    • Definisikan shell variable CC_NAME di /etc/eucalyptus/eucalyptus-cc.conf
    • Definisikan shell variable CC_IP_ADDR di /etc/eucalyptus/eucalyptus-ipaddr.conf, sebagai daftar IP address yang di pisahkan spasi.
  • Untuk Registrasi Walrus Controller:
    • Definisikan shell variable WALRUS_IP_ADDR di /etc/eucalyptus/eucalyptus-ipaddr.conf, sebagai sebuah IP address

Pada Cluster Controller:

  • Untuk Registrasi Storage Controller:
    • Definisikan nama cluster di shell variable CC_NAME di /etc/eucalyptus/eucalyptus-cc.conf
    • Definisikan shell variable SC_IP_ADDR di /etc/eucalyptus/eucalyptus-ipaddr.conf, berupa IP address yang dipisahkan oleh spasi.

Publikasi

Sekarang, kita dapat mulai mempublikasi layanan ke jaringan

  • Walrus Controller:
sudo start eucalyptus-walrus-publication
  • Cluster Controller:
sudo start eucalyptus-cc-publication
  • Storage Controller:
sudo start eucalyptus-sc-publication
  • Node Controller
sudo start eucalyptus-nc-publication


Start Listener

Pada Cloud Controller dan Cluster Controller, jalankan:

sudo start uec-component-listener


Verifikasi Registrasi

cat /var/log/eucalyptus/registration.log
2010-04-08 15:46:36-05:00 | 24243 -> Calling node cluster1 node 10.1.1.75
2010-04-08 15:46:36-05:00 | 24243 -> euca_conf --register-nodes returned 0
2010-04-08 15:48:47-05:00 | 25858 -> Calling walrus Walrus 10.1.1.71
2010-04-08 15:48:51-05:00 | 25858 -> euca_conf --register-walrus returned 0
2010-04-08 15:49:04-05:00 | 26237 -> Calling cluster cluster1 10.1.1.71
2010-04-08 15:49:08-05:00 | 26237 -> euca_conf --register-cluster returned 0
2010-04-08 15:49:17-05:00 | 26644 -> Calling storage cluster1 storage 10.1.1.71
2010-04-08 15:49:18-05:00 | 26644 -> euca_conf --register-sc returned 0

STEP 5: Ambil Credential (Mandat)

Setelah menginstalasi dan booting maka Cloud Controller, pengguna dari cloud perlu mengambil Credential-nya (Mandat-nya). Hal ini dapat dilakukan melalui sebuah web browser, atau menggunakan command line.

Melalui Web Browser

  • Melalui Web Browser kita dapat mengakses melalui URL:
https://<cloud-controller-ip-address>:8443/

PENTING! Kita harus menggunakan secure connection, pastikan kita menggunakan "https" bukan "http" di URL. Kita akan memperoleh security certificate warning. Kita perlu meng-add an exception untuk dapat melihat halaman web tersebut. Jika kita tidak meng-accespt maka kita tidak akan bisa melihat halaman konfigurasi Eucalyptus.

  • Gunakan username 'admin' dan password 'admin' untuk pertama kali login (anda akan dikinta untuk mengganti password sesudah itu)
  • Ikuti instruksi di layar untuk meng-update admin password dan email address.
  • Sesudah proses konfigurasi pertama kali selesai dilakukan, klik pada tab 'credentials' yang berlokasi di kiri atas layar.
  • Klik pada tombol 'Download Credentials' untuk memperoleh sertifikat anda.
  • Simpan di ~/.euca
  • Unzip file zip yang baru di download di lokasi yang aman (~/.euca)
unzip -d ~/.euca mycreds.zip

Tampilan proses pengambilan credential dapat dilihat di Ubuntu Enterprise Cloud: Pengambilan Credential


Melalui Command Line

Alternatif lain, kita dapat menggunakan command line di Cloud Controller, kita dapat menjalankan:

mkdir -p ~/.euca
chmod 700 ~/.euca
cd ~/.euca
sudo euca_conf --get-credentials mycreds.zip
unzip mycreds.zip
ln -s ~/.euca/eucarc ~/.eucarc
cd -


Extrak dan Menggunakan Credentials Anda

Selanjutnya, kita perlu mensetup EC2 API dan tool AMI di server anda menggunakan sertifikat X.509.

  • Install tool cloud user yang dibutuhkan:
sudo apt-get install euca2ools
  • Untuk memvalidasi semua berjalan dengan baik, ambil dari cluster lokal ketersediaan yang ada
. ~/.euca/eucarc
euca-describe-availability-zones verbose
AVAILABILITYZONE   myowncloud                 192.168.1.1
AVAILABILITYZONE   |- vm types                free / max   cpu   ram  disk
AVAILABILITYZONE   |- m1.small                0004 / 0004   1    192     2
AVAILABILITYZONE   |- c1.medium               0004 / 0004   1    256     5
AVAILABILITYZONE   |- m1.large                0002 / 0002   2    512    10
AVAILABILITYZONE   |- m1.xlarge               0002 / 0002   2   1024    20
AVAILABILITYZONE   |- c1.xlarge               0001 / 0001   4   2048    20


STEP 6: Install Image dari Store

Keterangan berikut ini adalah cara yang paling sederhana untuk menginstalasi image.

Cara yang paling sederhana untuk menambahkan image UEC adalah menginstalasi dari Image Store melalui interface UEC web.

  • Akses interface Web melalui URL berikut (Pastikan anda menggunakan https):
https://<cloud-controller-ip-address>:8443/
  • Masukan username dan password jika diminta (jika diminta, karena kemungkinan kita masuk login dari sesi sebelumnya)
  • Klik pada Store tab
  • Klik Search, maka akan di perlihatkan Image yang tersedia
Private-store-cr.png
  • Browse Image yang tersedia
  • Klik install untuk Image yang kita inginkan


Setelah Image di download dan di install, kita dapat mengklik "How to run?" yang akan memperlihatkan that will be displayed below the image button to view the command to execute to instantiate (start) this image. The image will also appear on the list given on the Image tab.

Private-images-cr.png

CATATAN: Untuk advanced user, yang tertarik untuk membuat Image sendiri dapat membaca Bundle their own image.

STEP 7: Run an Image

There are multiple ways to instantiate an image in UEC:

  • Use the command line
  • Use one of the UEC compatible management tools such as Landscape
  • Use the ElasticFox extension to Firefox

Here we will describe the process from the command line:

  • Before running an instance of your image, you should first create a keypair (ssh key) that you can use to log into your instance as root, once it boots. The key is stored, so you will only have to do this once. Run the following command:
if [ ! -e ~/.euca/mykey.priv ]; then
    mkdir -p -m 700 ~/.euca
    touch ~/.euca/mykey.priv
    chmod 0600 ~/.euca/mykey.priv
    euca-add-keypair mykey > ~/.euca/mykey.priv
fi
Note: You can call your key whatever you like (in this example, the key is called 'mykey'), but remember what it is called. If you forget, you can always run euca-describe-keypairs to get a list of created keys stored in the system.
  • You must also allow access to port 22 in your instances:
euca-authorize default -P tcp -p 22 -s 0.0.0.0/0
  • Next, you can create instances of your registered image:
euca-run-instances $EMI -k mykey -t m1.small
Note: If you receive an error regarding image_id, you may find it by viewing Images page or click "How to Run" on the Store page to see the sample command.
  • The first time you run an instance, the system will be setting up caches for the image from which it will be created. This can often take some time the first time an instance is run given that VM images are usually quite large. To monitor the state of your instance, run:
watch -n5 euca-describe-instances

In the output, you should see information about the instance, including its state. While first-time caching is being performed, the instance's state will be 'pending'.

  • When the instance is fully started, the above state will become 'running'. Look at the IP address assigned to your instance in the output, then connect to it:
IPADDR=$(euca-describe-instances | grep $EMI | grep running | tail -n1 | awk '{print $4}')
ssh -i ~/.euca/mykey.priv ubuntu@$IPADDR
  • And when you are done with this instance, exit your SSH connection, then terminate your instance:
INSTANCEID=$(euca-describe-instances | grep $EMI | grep running | tail -n1 | awk '{print $2}')

euca-terminate-instances $INSTANCEID


More Information

How to use the Storage Controller

Controlling eucalyptus services:

  • sudo service eucalyptus [start|stop|restart] (on the CLC/CC/SC/Walrus side)
  • sudo service eucalyptus-nc [start|stop|restart] (on the Node side)

Locations of some important files:

  • Log files:
/var/log/eucalyptus 
  • Configuration files:
/etc/eucalyptus 
  • Database:
/var/lib/eucalyptus/db 
  • Keys
/var/lib/eucalyptus
/var/lib/eucalyptus/.ssh 

Notes:

  • Don't forget to source your ~/.euca/eucarc before running the client tools.

Links:

  • Eucalyptus Project Site (forums, documentation, downloads)
  • Eucalyptus on Launchpad (bugs, code)
  • Eucalyptus Troubleshooting (1.5)
  • Register your cloud with RightScale

Glossary

The Ubuntu Enterprise Cloud documentation uses terminology that might be unfamiliar to some readers. This page is intended to provide a glossary of such terms and acronyms.

  • Cloud - A federated set of physical machines that offer computing resources through virtual machines, provisioned and recollected dynamically.
  • Cloud Controller (CLC) - Eucalyptus component that provides the web UI (an https server on port 8443), and implements the Amazon EC2 API. There should be only one Cloud Controller in an installation of UEC. This service is provided by the Ubuntu eucalyptus-cloud package.
  • Cluster - A collection of nodes, associated with a Cluster Controller. There can be more than one Cluster in an installation of UEC. Clusters are sometimes physically separate sets of nodes. (e.g. floor1, floor2, floor2).
  • Cluster Controller (CC) - Eucalyptus component that manages collections of node resources. This service is provided by the Ubuntu eucalyptus-cc package.
  • EBS - Elastic Block Storage. http://aws.amazon.com/ebs/
  • EC2 - Elastic Compute Cloud. Amazon's pay-by-the-hour, pay-by-the-gigabyte public cloud computing offering.
  • EKI - Eucalyptus Kernel Image.
  • EMI - Eucalyptus Machine Image.
  • ERI - Eucalyptus Ramdisk Image.
  • Eucalyptus - Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems. An open source project originally from the University of California at Santa Barbara, now supported by Eucalyptus Systems, a Canonical Partner.
  • Front-end - Physical machine hosting one (or more) of the high level Eucalyptus components (cloud, walrus, storage controller, cluster controller).
  • Node - A node is a physical machine that's capable of running virtual machines, running a node controller. Within Ubuntu, this generally means that the CPU has VT extensions, and can run the KVM hypervisor.
  • Node Controller (NC) - Eucalyptus component that runs on nodes which host the virtual machines that comprise the cloud. This service is provided by the Ubuntu package eucalyptus-nc.
  • S3 - Simple Storage Service. Amazon's pay-by-the-gigabyte persistent storage solution for EC2. http://aws.amazon.com/s3/
  • Storage Controller (SC) - Eucalyptus component that manages dynamic block storage services (EBS). Each 'cluster' in a Eucalyptus installation can have its own Storage Controller. This component is provided by the 'eucalyptus-sc' package.
  • UEC - Ubuntu Enterprise Cloud. Ubuntu's cloud computing solution, based on Eucalyptus.
  • VM - Virtual Machine.
  • VT - Virtualization Technology. An optional feature of some modern CPUs, allowing for accelerated virtual machine hosting.
  • Walrus - Eucalyptus component that implements the Amazon S3 API, used for storing VM images and user storage using S3 bucket put/get abstractions.

e-book

http://cssoss.wordpress.com/2010/06/22/pdf-version-of-eucalyptus-beginners-guide-uec-edition/

Referensi

Pranala Menarik