zoukankan      html  css  js  c++  java
  • Eucalyptus1.6.2安装使用说明 in CentOS5.5 x86(原)

    Eucalyptus安装使用说明

    Eucalyptus

    结构拓扑

     

    五个组成部分

    1.         Cloud controller (CLC) 

    简单的说就是一个提供Web访问的接口,使用java的

            a Java program that offers EC2-compatible SOAP and "Query"interfaces

    2.         Walrus 

    written in Java,implements bucket-based storage, which is available outside andinside a cloud through S3-compatible SOAP and REST interfaces.

    3.         Cluster controller (CC) 

    群集控制器,控制NC节点群集的(这里因为是实验,CLC和CC都安装在一台机器上)

            CC and NC are written in C and deployed as Web services insideApache       

    4.         Node controller (NC) 

    具体落实跑虚拟机镜像的机器,最好是CPU支持虚拟化的,要安装64位系统,所以,各位就不要安装在虚拟机了,需要安装双系统。

            CC and NC are written in C and deployed as Web services insideApache

    5.         Storage controller (SC) 

     a "storagecontroller" (SC) for EBS-style block-based storage

    written in Java.

    takes place overSOAP with WS-security.

    述语介绍:

    1.         front-end 

    componentsexcept NC are co-located on one machine 

    2.         nodes 

    running only NCs

    front-end

    In more advancedconfigurations, such as those with multiple CCs or with Walrus deployedseparately, the front-end will refer to just the machine running theCLC.

    安装方法

    Installing from source

    a more generalmethod and should work on practically any Linux system

    installing from packages(RPM and DEB)

    is easier butwill only work on the distributions that we support

    • CentOS 5
    • Debian squeeze
    • OpenSUSE 11
    • Fedora 12

    Installing Eucalyptus(1.6.2) from packages(RPM and DEB) CentOS5

    下载安装压缩包

            安装在64位物理机上,所以需要有64位的CPU主机。

    在页面http://open.eucalyptus.com/downloads下载Eucalyptus 1.6.2 - RHEL / CentOS 5.4 - x86_64和Euca2ools 1.2 - RHEL /CentOS 5.4 - x86_64

    解压缩安装包

    tar zxvfeucalyptus-$VERSION-*.tar.gz

    tar zxvf euca2ools-$VERSION-*.tar.gz

    cdeucalyptus-$VERSION-*

    0、准备工作

    需要安装gcc, java-1.6.0-openjdk, ant,ant-nodeps, dhcp, bridge-utils, httpd, swig,安装文件.rpm在CentOS5.5的光盘中可以找到,在目录/CentOS下

    安装gcc

    rpm -ivh cpp-4.1.2-48.el5.x86_64.rpm

    rpm -ivh kernel-headers-2.6.18-194.el5.x86_64.rpm

    rpm -ivh glibc-headers-2.5-49.x86_64.rpm 

    rpm -ivh glibc-devel-2.5-49.x86_64.rpm 

    rpm -ivh libgomp-4.4.0-6.el5.x86_64.rpm

    rpm -ivh gcc-4.1.2-48.el5.x86_64.rpm

    安装java-1.6.0-openjdk

    rpm -ivh java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5.x86_64.rpm

    rpm -ivh java-1.6.0-openjdk-devel-1.6.0.0-1.7.b09.el5.x86_64.rpm

    安装ant

    rpm -ivh ant-1.6.5-2jpp.2.x86_64.rpm

    安装ant-nodeps

    rpm -ivh ant-nodeps-1.6.5-2jpp.2.x86_64.rpm

    安装dhcp

    rpm -ivh dhcp-3.0.5-23.el5.x86_64.rpm

    安装bridge-utils

    rpm -ivh bridge-utils-1.1-2.x86_64.rpm

    安装httpd

    rpm -ivh httpd-2.2.3-43.el5.centos.x86_64.rpm

    安装swig

    rpm -ivh swig-1.3.29-2.el5.x86_64.rpm

    如果分别在前端和节点端两个主机上安装
    1on the front end, install the -cloud, -walrus, -ccand -sc RPMs

    rpm -Uvhaoetools-21-1.el4.x86_64.rpm euca-axis2c-1.6.0-1.x86_64.rpmeuca-rampartc-1.3.0-1.x86_64.rpm vblade-14-1mdv2008.1.x86_64.rpm lzo2-2.02-3.el5.rf.x86_64.rpmvtun-3.0.2-1.el5.rf.x86_64.rpmperl-Crypt-OpenSSL-Random-0.04-1.el5.rf.x86_64.rpm perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.x86_64.rpmperl-Crypt-X509-0.32-1.el5.rf.noarch.rpm python25-2.5.1-bashton1.x86_64.rpmpython25-devel-2.5.1-bashton1.x86_64.rpmpython25-libs-2.5.1-bashton1.x86_64.rpm euca2ools-1.2-1.x86_64.rpm

    export VERSION=1.6.2

    export ARCH=x86_64

    rpm -Uvheucalyptus-$VERSION-*.x86_64.rpm eucalyptus-common-java-$VERSION-*.x86_64.rpm  eucalyptus-cloud-$VERSION-*.x86_64.rpm eucalyptus-walrus-$VERSION-*.x86_64.rpmeucalyptus-sc-$VERSION-*.x86_64.rpm eucalyptus-cc-$VERSION-*.x86_64.rpm eucalyptus-gl-$VERSION-*.x86_64.rpm

    2on the nodes, install the node controller RPM

    export VERSION=1.6.2

    export ARCH=x86_64

    rpm -Uvhaoetools-21-1.el4.x86_64.rpm euca-axis2c-1.6.0-1.x86_64.rpmeuca-rampartc-1.3.0-1.x86_64.rpm perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.x86_64.rpmperl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.x86_64.rpm perl-Crypt-X509-0.32-1.el5.rf.noarch.rpmpython25-2.5.1-bashton1.x86_64.rpm python25-devel-2.5.1-bashton1.x86_64.rpm python25-libs-2.5.1-bashton1.x86_64.rpmeuca2ools-1.2-1.x86_64.rpm

    rpm -Uvheucalyptus-$VERSION-*.x86_64.rpm eucalyptus-gl-$VERSION-*.x86_64.rpm eucalyptus-nc-$VERSION-*.x86_64.rpm

    如果前端和节点都安装在一个主机上

            上面的1、2两节跳过,只需运行如下命令:

    export VERSION=1.6.2

    export ARCH=x86_64

    rpm -Uvhaoetools-21-1.el4.x86_64.rpm euca-axis2c-1.6.0-1.x86_64.rpmeuca-rampartc-1.3.0-1.x86_64.rpm vblade-14-1mdv2008.1.x86_64.rpmvtun-3.0.2-1.el5.rf.x86_64.rpm lzo2-2.02-3.el5.rf.x86_64.rpmperl-Crypt-OpenSSL-Random-0.04-1.el5.rf.x86_64.rpmperl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.x86_64.rpmperl-Crypt-X509-0.32-1.el5.rf.noarch.rpm python25-2.5.1-bashton1.x86_64.rpmpython25-libs-2.5.1-bashton1.x86_64.rpm euca2ools-1.2-1.x86_64.rpm

    rpm -Uvheucalyptus-$VERSION-*.x86_64.rpm eucalyptus-common-java-$VERSION-*.x86_64.rpm  eucalyptus-cloud-$VERSION-*.x86_64.rpm eucalyptus-walrus-$VERSION-*.x86_64.rpmeucalyptus-sc-$VERSION-*.x86_64.rpm eucalyptus-cc-$VERSION-*.x86_64.rpm eucalyptus-gl-$VERSION-*.x86_64.rpmeucalyptus-nc-$VERSION-*.x86_64.rpm

    3、查看系统管理
        virsh list
    4、修改系统管理的配置
    vim /etc/xen/xend-config.sxp
    // 修改设置如下
    (xend-http-server yes)
    (xend-unix-server yes)
    (xend-unix-path /var/lib/xend/xend-socket)
    (xend-address localhost)
    (network-script network-bridge)
    (vif-script vif-bridge)
    (dom0-min-mem 196)
    (dom0-cpus 0)
    (vncpasswd '')
    重启xen,运行以下命令查看是否设置正确

    /etc/init.d/xend restart

    su eucalyptus -c "virsh list"

    5、On thefront-end:

            运行CLC、Walrus、SC和CC:

            (注意,如果CC启动失败,需要关闭selinux)

    /etc/init.d/eucalyptus-cloud start

    /etc/init.d/eucalyptus-cc start

    或者命令

    $EUCALYPTUS/usr/sbin/euca_conf --enable cloud
    $EUCALYPTUS/usr/sbin/euca_conf --enable walrus
     
    通过命令查看运行状态

    /etc/init.d/eucalyptus-cloud status

    /etc/init.d/eucalyptus-cc status

    6、On the node:

            运行NC:

    /etc/init.d/eucalyptus-nc start

    或者命令

    $EUCALYPTUS/usr/sbin/euca_conf --enable sc
     
    通过命令查看运行状态

    /etc/init.d/eucalyptus-nc status

    Registering Eucalyptus Components注册到Eucalyptus

    http://open.eucalyptus.com/wiki/EucalyptusFirstTimeSetup_v2.0

    在前端分别注册IP到walrus、cluster和sc

            运行前,需要在shell终端设置JAVA_HOME的路径,如下

    exportJAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64

    exportPATH=.:$JAVA_HOME/bin:$PATH

    exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    $EUCALYPTUS/usr/sbin/euca_conf--register-walrus <front end IP address>

    $EUCALYPTUS/usr/sbin/euca_conf--register-cluster <clustername> <front end IP address>

    $EUCALYPTUS/usr/sbin/euca_conf--register-sc <clustername> <front end IP address>

    <clustername>随便起个名字

    <front end IP address>为安装后虚拟网卡的入口地址,使用以下命令:(其中xenbr0对应的interfaces的值即为网卡名称

    [root@clc]# brctlshow

    bridge name bridgeid   STP enabled interfaces

    virbr0      8000.000000000000   yes

    xenbr0      8000.feffffffffff   no  peth0

    得到xen对应的虚拟网卡的名称,再使用以下命令,设置该网卡的入口连接地址:(假如设置为192.168.1.100)

    ifconfig peth0 192.168.1.100

    使用命令service network restart刷新网络连接

    使用命令ifconfig可以查看网卡peth0的连接地址为192.168.1.100

    在前端添加NC的注册节点

    $EUCALYPTUS/usr/sbin/euca_conf --register-nodes "<Node 0 IP address> <Node 1 IP address> ... <Node N IP address>"

            <Node 0 IP address>为运行NC的主机IP地址

    初使化配置

         使用浏览器打开网页https://localhost:8443,使用户名admin和密码admin登录

            第一次登录,会提示修改密码,修改即可。

    下载密钥和证书

    1.         在Credentials分栏,点击“CredentialsZIP-file”下的“DownloadCredentials”按钮,下载euca2-admin-x509.zip到本地。

    2.         使用命令unzipeuca2-admin-x509.zip解压该文件,其中含有公、私钥和证书文件等。

    mkdir ~/keys
    cd ~/keys   
    unzip euca2-admin-x509.zip

    3.         设置该文件夹的访问权限:

    chmod 0700 ~/keys
    chmod 0600 ~/keys/*

    4.         使用时,需在shell命令终端,设置该目录文件eucarc在公共路径下(假如将文件解压到~/credentials/下)

    . ~/ keys/eucarc

    网络配置

    1.       获取xen对应的虚拟网卡的名称,由之前的内容可知为peth0

    2.       打开文件/etc/eucalyptus/eucalyptus.conf,进行如下一系列设置

    VNET_PUBINTERFACE=”eth0”

    VNET_PRIVINTERFACE=”peth0”

    VNET_MODE=”MANAGED”

    VNET_SUBNET=”192.168.1.100”

    VNET_NETMASK=”255.255.255.224”

    VNET_DNS=”10.5.19.225”

    VNET_ADDRSPERNET=”32”

    VNET_PUBLICIPS=”10.5.19.1-10.5.19.5”(随便设置的一个内部IP段)

    VNET_LOCALIP=”10.5.19.51”(本机的IP地址)

    VNET_CLOUDIP=”10.5.19.51”(设置的cloud的IP地址)

    创建image

    http://open.eucalyptus.com/wiki/EucalyptusImageManagement_v2.0

    1、下载可用的images,此处下载64位的Ubuntu pre-packaged image

    http://open.eucalyptus.com/wiki/EucalyptusUserImageCreatorGuide_v2.0

    2、解压文件

    tar zxvfeuca-ubuntu-9.04-x86_64.tar.gz

    3、注册成一个ubuntu-kernel-bucket,返回一个eki号为eki-xxxxxxxx
    // xen
    euca-bundle-image -i euca-ubuntu-9.04-x86_64/xen-kernel/vmlinuz-2.6.27.21-0.1-xen --kernel true
    euca-upload-bundle -b ubuntu-kernel-bucket -m /tmp/vmlinuz-2.6.27.21-0.1-xen.manifest.xml euca-register ubuntu-kernel-bucket/vmlinuz-2.6.27.21-0.1-xen.manifest.xml
     
    // kvm 
      euca-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/vmlinuz-2.6.28-11-generic --kernel true
    euca-upload-bundle -b ubuntu-kernel-bucket -m /tmp/vmlinuz-2.6.28-11-generic.manifest.xml
    euca-register ubuntu-kernel-bucket/vmlinuz-2.6.28-11-generic.manifest.xml
    4、注册成一个ubuntu-ramdisk-bucket,返回一个eri号eri-xxxxxxxx
    // xen
    euca-bundle-image -i euca-ubuntu-9.04-x86_64/xen-kernel/initrd-2.6.27.21-0.1-xen --ramdisk true
    euca-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml
    euca-register ubuntu-ramdisk-bucket/initrd.img-2.6.28-11-generic.manifest.xml
     
    // kvm
    euca-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true
    euca-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml
    euca-register ubuntu-ramdisk-bucket/initrd.img-2.6.28-11-generic.manifest.xml
    5、注册成一个ubuntu-image-bucket,返回一个emi号emi-xxxxxxxx
    // xen
    euca-bundle-image -i euca-ubuntu-9.04-x86_64/ubuntu.9-04.x86-64.img --kernel eki-945B170A  --ramdisk eri-1752192F
    euca-upload-bundle -b ubuntu-image-bucket -m  /tmp/ubuntu.9-04.x86-64.img.manifest.xml
    euca-register ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml
     
    // kvm
    euca-bundle-image -i euca-ubuntu-9.04-x86_64/ubuntu.9-04.x86-64.img --kernel eki-xxxxxxxx --ramdisk eri-xxxxxxxx
    euca-upload-bundle -b ubuntu-image-bucket -m /tmp/ubuntu.9-04.x86-64.img.manifest.xml
    euca-register ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml
    6、使用命令euca-describe-images可以查看已注册成功的信息

    euca-describe-images

    创建 Keypairs

    http://open.eucalyptus.com/wiki/EucalyptusGettingStarted_v2.0

            创建一个keypairs,并保存到本地文件mykey.private,如下:

    euca-add-keypair mykey | tee mykey.private

    启动instance

    http://open.eucalyptus.com/wiki/Euca2oolsVMControl_v1.3

            注:确保设置的硬盘大小,不小于为image的三倍(http://open.eucalyptus.com/wiki/EucalyptusTroubleshooting_v2.0#walrus)

            注:设置模式为MANAGED

    查看console output:

    如果使用的是KVM:euca-get-console-output

    如果使用的是XEN:xm console

     

    启动一个instance

    euca-describe-images
    euca-run-instances -k mykey -n <number of instances to start> <emi-id> 
    查看一个instance的运行状态(pending, running, shutdown, terminated)
    euca-describe-instances

    登陆instance

    如果instance为running状态

    设置该instance的22端口可用

    euca-authorize -P tcp -p 22 -s 192.168.1.x/0 default   (0.0.0.0为运行instance时,返回显示的私有IP地址,应该如192.168.1.x

    利用keypair登录到虚拟机中

    ssh -i mykey.private root@<accessible-instance-ip>     (<accessible-instance-ip>为运行instance时,返回显示的公有IP地址,应该如10.5.19.x)

    关闭instance

    euca-terminate-instances <instance-id1>
     
     

    HOWTO

    In the following howto’s, <image file> should bereplaced with a reference to a specific .img file.

    How do I mount an image without bootingit?

    • mkdir -p /mnt/loop
    • mount -o loop <imagefile> /mnt/loop/

    How do I resize an image file?

    First, make sure that the image file is not already mountedand is not already running as a xen guest. The following commands increase animage file to 2.5GB. Backup the image before attempting this.

    • dd if=/dev/zero of=<imagefile> bs=1Mconv=notrunc count=1 seek=2500
    • losetup /dev/loop0 <imagefile>
    • e2fsck -f /dev/loop0
    • resize2fs /dev/loop0
    • e2fsck -f /dev/loop0
    • losetup -d /dev/loop0

    You may then boot or mount the image to confirm theincreased size. The e2fsck checks in this howto are not strictly necessary.

    How do I move the contents of an img fileto a regular partition?

    Mount the img file using the above howto. Assuming thedestination partition is mounted at /mnt/dest, execute the following:

    • cp -a /mnt/loop/* /mnt/dest/

    You will then be able to boot the filesystem using thepartition instead of the image file, which should provide better performance.You will need to update the *.xen.cfg file to reference the partition insteadof the img file (the disk parameter will need to change, see the XenManual). Also, remember to unmount partitions or img files before booting axen guest from them!

     

    路径:

    安装clc,cc,nc,images后的路径:/var/lib/eucalyptus/
    启动instance后的eucalyptus的文件系统生成: /usr/local/eucalyptus//admin/instance-id
    Xen启动虚拟机的配置文件: /etc/xen/instance-id

    问题

    问题:运行命令ssh -i mykey.private root@<accessible-instance-ip>登录时,提示超时,无法进入,估计是网络配置还存在问题。
    状态:已解决。
    方法:文件/etc/eucalyptus/eucalyptus.conf中MANAGED模式下的配置文件如下:
    VNET_PUBINTERFACE="eth0"
    VNET_PRIVINTERFACE="eth0"
    VNET_MODE="MANAGED"
    VNET_SUBNET="192.168.0.0"
    VNET_NETMASK="255.255.0.0"
    VNET_DNS="10.0.1.100"
    VNET_ADDRSPERNET="32"
    VNET_PUBLICIPS="10.0.1.101-10.0.1.105"
    原因:因eucalyptus系统默认设置用户组的范围为10~ 4095个,且每个用户组的节点个数为32(在VNET_ADDRSPERNET中设置),因之前设置的VNET_NETMASK为255.255.255.0,使得用户组个数为255/32 < 8,导致启动的instance后,分配的用户组IP地址非分配的IP段中,导致连接instance失败。
            用户组个数计算方法:security groups = min(VLAN-end, #subnet) - VLAN-start
     
     
     
    问题:private IP和public IP都分配正确,但处于running中的instance,ssh上去后,显示的为CC的主机内容,并不是分配节点的主机中启动的instance的VM。输入启动VM的console信息硬盘挂载不成功:
    后台console输出显示:
    Begin: Running /scripts/init-premount ...
    Done.
    Begin: Mounting root file system... ...
    Begin: Running /scripts/local-top ...
    Done.
    Begin: Waiting for root file system... ...
    Done.
    Gave up waiting for root device.  Common problems:
     - Boot args (cat /proc/cmdline)
       - Check rootdelay= (did the system wait long enough?)
       - Check root= (did the system wait for the right device?)
     - Missing modules (cat /proc/modules; ls /dev)
    ALERT! /dev/sda1 does not exist. Dropping to a shell!
     
     
    BusyBox v1.10.2 (Ubuntu 1:1.10.2-2ubuntu7) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    Virtual machine的描述:

    Virtual disk:

    Source type:file

    Source path:/usr/local/eucalyptus//admin/i-435D0879/root

    Target type:disk

    Targetdevice: sda1

    Target bus:scsi

    Permissions:read/write

    Virtual disk:

    Source type:file

    Source path:/usr/local/eucalyptus//admin/i-435D0879/ephermeral

    Target type:disk

    Targetdevice: sdas

    Target bus:scsi

    Permissions:read/write

    Virtual disk:

    Source type:file

    Source path:/usr/local/eucalyptus//admin/i-435D0879/swap

    Target type:disk

    Targetdevice: sdas

    Target bus:scsi

    Permissions:read/write

    Virtualnetwork interface

    Source type:bridge

    Sourcedevice: eucabr10

    Source model:Hypervisor Default

    MAC address:d0:0d:43:5d:08:79

    Consoledevice

    Device type:pty

    Targe port: 0

    Source path:/dev/pts/2

    问题:mac变成fe:ff:ff:ff:ff:ff,IP分配不成功。

    问题:instance启动成功,ssh无法登录

    尝试解决登录xen的虚拟机的方法:

    VNET_MODE="MANAGED"

    VNET_SUBNET="192.168.0.0"

    VNET_NETMASK="255.255.0.0"

    VNET_DNS="172.0.0.0"

    VNET_ADDRSPERNET="32"

    VNET_PUBLICIPS="172.0.0.1-172.0.0.5"

    VNET_LOCALIP="10.5.19.32"

    VNET_CLOUDIP="10.5.19.26"

    1、设置eucalyptus.conf如下:

    VNET_PUBINTERFACE="eth0"

    VNET_PRIVINTERFACE="eth0"

    结果:可以启动instance成功,但无法登录到虚拟机系统中

    2、设置eucalyptus.conf如下:

    VNET_PUBINTERFACE="xenbr0"

    VNET_PRIVINTERFACE=" xenbr0"

    结果:可以启动instance成功,使用keypair来ssh登录到虚拟机系统中成功!

    注意:使用第二个IP来登录(非设置的public IP)。

    现在,前端和节点在同一台电脑上,是可以正常的启动、连接登录进行操作的。下一步,如何架设区域网内的虚拟机环境。

    尝试解决架设区域网内的虚拟机环境:

    前端和节点分别架设在不同的电脑上,且这两台电脑在某一个路由下面。

    1、前端的eucalyptus.conf文件内容不变,节点的eucalyptus.conf文件中,设置如下:

    VNET_PUBINTERFACE="eth0"

    VNET_PRIVINTERFACE="eth0"

    VNET_MODE="MANAGED"

    VNET_SUBNET="192.168.0.0"

    VNET_NETMASK="255.255.0.0"

    VNET_DNS="172.0.0.0"

    VNET_ADDRSPERNET="32"

    VNET_PUBLICIPS="172.0.0.1-172.0.0.5"

    VNET_LOCALIP="10.5.19.32"

    VNET_CLOUDIP="10.5.19.26"

    结果:instance一直处于pending状态,无法到running状态,即无法成功启动。最后造成节点主机死机,重启后mac又被变为广播mac。

    2、

  • 相关阅读:
    Python基础知识(八)—字典
    Python基础知识(七)—元组
    Python基础知识(六)—关于列表深拷贝和浅拷贝及内存图
    Python基础知识(六)—列表
    Python基础知识(五)—字符串
    4、FTP、SSH协议简单介绍
    3、apt-get install xxx时,报错信信息: Could not get lock /var/lib/dpkg/lock-frontend
    2、NFS挂载根文件系统失败:Root-NFS: Unable to get mountd port number from server, using default
    EXPORT_SYMBOL是什么?
    用maven建立一个工程2
  • 原文地址:https://www.cnblogs.com/BloodAndBone/p/1882071.html
Copyright © 2011-2022 走看看