UEC: Manajemen Instance

From OnnoWiki
Revision as of 18:21, 21 October 2010 by Onnowpurbo (talk | contribs) (New page: There are broadly three types of tools that you can use to manage Eucalyptus instances. 1. Firefox Plugins – Elasticfox and Hybridfox 2. Command Line tools like euca2ools 3. Cu...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are broadly three types of tools that you can use to manage Eucalyptus instances.

  1. Firefox Plugins – Elasticfox and Hybridfox
  2. Command Line tools like euca2ools
  3. Custom applications developed using EC2 APIs. ( Will not be covered in this beginner’s guide )

Elasticfox

Elasticfox is an open source Mozilla Firefox extension that works on Firefox Version 2.0 or later to help you with managing your Amazon EC2 account – Launch new instances, mount Elastic Block Storage volumes, map Elastic IP addresses, and more. This was originally written for EC2, but, since version xxx.xxx, it can also be used for managing your Eucalyptus account as well, because API of Eucalyptus is compatible with that of EC2. Features

   * List available Machine images (AMIs in the case of AWS and EMIs in the case of Eucalyptus)
   * List running instances
   * Launch new instances of an AMI/EMI
   * Manage security groups and rules
   * Manage Snapshots/EBS volumes

Installation on Firefox

Install the extension from http://s3.amazonaws.com/ec2-downloads/elasticfox.xpi

You will need to restart Firefox before you can start using Elasticfox. You can launch Elasticfox from ‘Tools’ menu of Firefox. Configuration Define a Region

   * Click on Regions button
   * Enter a logical name for the region (Example: “Eucalyptus” , “MyEucalyptus” etc.)
   * Enter the value of EC2_URL from your eucarc file as the Endpoint URL(http://192.168.10.121:8773/services/Eucalyptus in our sample setup)

Define Credentials

   * Click on Credentials button
   * Enter a logical name for the credential set (Example: “EucaAcc1″ etc.)
   * Enter EC2_ACCESS_KEY and EC2_SECRET_KEY from your eucarc file as the AWS Access Key and AWS Secret Access Key respectively

Define Key Pairs

   * Click on KeyPairs tab
   * Click on “Create a ney keypair” icon
   * Enter a name for the key pair (Example: “eucakey” etc.)
   * Choose location on the client machine to save the id file to (You will need this to use with putty etc. to make an SSH connection)

Define Security Groups

   * Click on SecurityGroups tab
   * Enter a name for the group (Example: “Eucalyptus”, “EucaGroup” etc.)
   * Enter the description and click on create button
   * You will have an option to specify some basic ports like SSH/RDP to be opened up while creating the group itself. After the group is created, you can add rules any time by choosing the security group in the left pane titled “Your groups” and adding rules in the right pane titled “Group Permissions”

For more information, http://ec2-downloads.s3.amazonaws.com/elasticfox-owners-manual.pdf Hybridfox

Hybridfox was forked from Elasticfox to make it usable with Eucalyptus, when Elasticfox worked only with AWS. Hybridfox can be used as the single interface to AWS and Eucalyptus.

The interface of Hybridfox is similar to Elasticfox and all the above steps in configuring Elasticfox apply to Hybridfox as well.

Even after the recent release of Elasticfox (version 1.7) with support for Eucalyptus, Hybridfox has the following additional features that make it attractive for users of Eucalyptus:

   * Raising instances with Private IP
   * Some quirks related to hard coded mapping of instance types and architecture types addressed
   * Support for Eucalyptus 1.5.x as well as 1.6.x
   * Other usability enhancements

You can install the extension from http://code.google.com/p/hybridfox/downloads/list. The latest version (at the time of writing) is hybridfox-1.6.000024.xpi.

You will need to restart Firefox before you can start using Hybridfox. You can access Hybridfox from ‘Tools’ menu of Firefox. Screenshots

Command Line Tools (Euca2ools)

Euca2ools from Eucalyptus provide a bunch of command line tools to manage the eucalyptus setup. These commands help you manage images, instances, storage, networking etc. A few commands related to managing the instances are given below.

For a complete list of commands, see Appendix. view source print? 1 $apt-get install euca2ools Creation of Key Pairs

Eucalyptus expects the client tools to use 2 kinds of credentials. One set of credentials are called Access Key and Secret Key that all clients would need to use to make any requests to the Cloud Controller. Each user registered on the web interface has this set created for him. You can download it from the web interface as mentioned in the chapter on “Web Interface”.

You will also need to generate a keypair consisting of private key/public key to be able to launch instances on Eucalyptus. These keys are injected into the instance and used to make passwordless SSH acess to the instance possible.

Keypairs can also be generated using the following commands. view source print? 1 uecadmin@client1:~$ cd ~/.euca 2 uecadmin@client1:~/.euca$ source eucarc 3 uecadmin@client1:~$ euca-add-keypair mykey > mykey.priv 4 uecadmin@client1:~$ chmod 600 mykey.priv

This creates a new keypair called mykey. The private key mykey.priv is saved locally which can be used to connect to an instance launched with mykey as the keypair. To list the available keypairs: view source print? 1 uecadmin@client1:~$ euca-describe-keypairs 2 KEYPAIR mykey f7:ac:8e:f5:05:19:2b:31:28:8c:9b:d7:b8:07:0c:3c:b6:34:8f:79 3 KEYPAIR helloworld 12:96:b3:21:34:8d:6a:3f:92:2e:2b:70:23:ff:7f:51:b5:b7:ad:37 4 KEYPAIR ubuntu f6:af:9a:59:65:35:32:c4:3a:c4:62:0e:e1:44:0f:71:29:03:2d:91 5 KEYPAIR lucid 74:04:70:33:ed:57:7a:30:36:1f:ca:c6:ec:d5:4f:10:34:1a:52:51 6 KEYPAIR karmic 01:f9:aa:5f:4d:20:e2:53:d1:29:d0:0f:e2:f3:8c:21:91:70:7e:c8

To delete an existing keypair: view source print? 1 uecadmin@client1:~$ euca-delete-keypair helloworld

The above tasks can be achieved using Hybridfox from the “Keypairs” tab. Launch and manage instances

The following commands can be used to launch an instance from the above generated keypair, check its status, connect to the instance etc. view source print? 1 $ euca-run-instances emi-721D0EBA -k mykey -t c1.medium 2 RESERVATION r-55560977 admin admin-default 3 INSTANCE i-50630A2A emi-721D0EBA 0.0.0.0 0.0.0.0 pending mykey 2010-05-07T07:17:48.23Z eki-675412F5 eri-A1E113E0 view source print? 1 $ euca-describe-instances 2 RESERVATION r-55560977 admin default 3 INSTANCE i-50630A2A emi-721D0EBA 192.168.10.200 172.19.1.2 running mykey 0 c1.medium 2010-05-07T07:17:48.23Z myueccluster eki-675412F5 eri-A1E113E0 view source print? 01 $ euca-get-console-output i-50630A2A 02 i-50630A2A 03 2010-05-07T07:22:40.795Z 04 [ 0.000000] Initializing cgroup subsys cpuset 05 [ 0.000000] Initializing cgroup subsys cpu 06 [ 0.000000] Linux version 2.6.32-21-server (buildd@yellow) (gcc version 4. 07 4.3 (Ubuntu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 (Ub 08 untu 2.6.32-21.32-server 2.6.32.11+drm33.2) 09 [ 0.000000] Command line: root=/dev/sda1 console=ttyS0 10 [ 0.000000] KERNEL supported cpus: 11 [ 0.000000] Intel GenuineIntel 12 [ 0.000000] AMD AuthenticAMD 13 [ 0.000000] Centaur CentaurHauls 14 [ 0.000000] BIOS-provided physical RAM map: 15 [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable) 16 [ 0.000000] BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved) 17 ............. 18 ............. 19 ............. view source print? 1 uecadmin@client1:~$ ssh -i mykey.priv user@192.168.10.200 view source print? 1 uecadmin@client1:~$ euca-reboot-instances i-50630A2A view source print? 1 uecadmin@client1:~$ euca-terminate-instances i-50630A2A

Make sure that you launch the instance with the correct VM type. If it is launched with a smaller VM type, then the following error is encountered. view source print? 1 error: insufficient disk capacity remaining

By default, m1.small is the VM type that is used which comes with a 2GB. So if you have a disk image of size 5GB, instead of view source print? 1 euca-run-instances emi-XXXXXXXX -k mykey

use view source print? 1 euca-run-instances emi-XXXXXXXX -k mykey -t c1.medium

VM type also has implications for amount of RAM and number of CPUs allocated to the instance. To know the configured VM types, please see the Configuration page of the web interface. Life cycle of an instance

When you invoke “euca-run-instances” command (or when you choose to run an instance from Hybridfox/Elasticfox), here are a few things that happen on various components of UEC:

   * Authentication/Authorization of the user request to ensure you have permission to launch the instance
   * Identification of CC to take responsibility for deploying the instance and identification of the NC for running the instance.
   * Downloading the image from WS3 to NC (images are cached so that starting multiple instances of the same machine image only downloads that image once)
   * Create the requested virtual network interface
   * Start the instance of the machine image running as a virtual machine using KVM

Starting and stopping of an instance is a complex process involving multiple components of UEC and a more detailed discussion is beyond the scope of a beginner’s guide.


Referensi

Pranala Menarik