俺的回收站

架构分析 解释编译原理
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

云计算EC2兼容平台 安装实践

Posted on 2010-08-20 16:01  Riceball LEE  阅读(1388)  评论(1编辑  收藏  举报

云计算EC2兼容平台 安装实践


最近我在公司中尝试安装搭建了基于 Eucalyptus 云计算EC2兼容平台的测试环境。用一台作为控制器,一台作为虚拟机节点,在此感谢综合服务部老马的支持。

Eucalyptus 的组成说明


Euc 的组成可以分为5类组件,它们之间是通过 SOAP with WS-security进行通信。

通过下图我们可以看到基于顶层的是Cloud Controller(clc)Walrus。我们将clc,walrus,sc,cc控制器称为前端节点,虚拟机控制器节点(nc)称为后端节点

控制器(前端节点):
  • the cloud controller (clc)
  • the cluster controller (cc)
  • walrus (the S3-like storage service)
  • the storage controller (sc)

虚拟机节点(后端节点):
  • 一个或多个node controller (nc)


组件描述:
  • 云控制器(Cloud Controller: CLC) 是Java写的,提供给外界 ec2 兼容的Web SOAP Service 和query接口以及Web界面交互,用来管理所有的集群。执行高层对资源的规划和系统用户的管理。
  • Walrus 是兼容Amazon S3的存储,也是java写的,为外界提供Key-Value存储服务。 顶层的cls和walrus可以汇集多个集群的资源。每一个集群需要一个集群控制器(cc)来管理计算节点(资源规划和网络控制),以及一个存储控制器(sc)。
  • 存储控制器(Storage Controller)实现EBS(Amazon Elastic Block Store)类型的块存储:所有的image文件存放于此,sc是用java写的。
  • 集群控制器Cluster controller (CC) - C 写的,提供对集群内部控制,在 Apache 內作为 Web services 來部署。
  • 虚拟机节点控制器Node controller (NC) - C 写的,安在提供虚拟机服务的节点上,在 Apache 內作为 Web services 來部署。


安装

鉴于ubuntu最新的Server版本已经直接集成了Eucalyptus Cloud Server的支持,能够创建Amazon EC2 基础设施上运行 Eucalyptus 的公共云和位于防火墙之后的数据中心内部的基础设施之上运行的私有云。这是到目前为止最为简单的安装和尝试使用 Eucalyptus 的方式。只需下载 CD 服务器版并将其安装在任何想要的地方。为了省事,所有机器安装 Ubuntu Server 10.04 LTS

如前所述,控制器(前端节点 10.34.7.102)上需要安装云控制器(clc),集群控制器(cc)S3存储服务(Walrus)Image存储控制器(sc)。控制器的服务器建议配置如下:
HardwareMinimumSuggestedNotes
CPU1GHz2 x 2GHzfor an all-in-one front end, it helps to have at least a dual core processor
Memory2GB4GBthe Java web front end benefits from lots of available memory
Disk5400rpm IDE7200rpm SATAslower disks will work, but will yield much longer instance startup times
Disk Space40GB200GB40GB is only enough space for only a single image, cache, etc., Eucalyptus does not like to run out of disk space
Networking100Mbps1000Mbpsmachine images are hundreds of MB, and need to be copied over the network to nodes


虚拟机节点控制器的服务器建议配置为:
HardwareMinimumSuggestedNotes
CPUVT extensionsVT, 64-bit, Multicore64-bit can run both i386, and amd64 instances; by default, Eucalyptus will only run 1 VM per CPU core on a Node
Memory1GB4GBadditional memory means more, and larger guests
Disk5400rpm IDE7200rpm SATA or SCSIEucalyptus nodes are disk-intensive; I/O wait will likely be the performance bottleneck
Disk Space40GB100GBimages will be cached locally, Eucalyptus does not like to run out of disk space
Networking100Mbps1000Mbpsmachine images are hundreds of MB, and need to be copied over the network to nodes


OK,下载ubuntu 10.04 Server ISO并刻盘
http://www.ubuntu.com/server/get-ubuntu/download

安装前端控制器节点


首先我们安装前端控制器节点, 从光盘引导,选择“Install Ubuntu Enterprise Cloud”. 


安装程序将会检查本地网络是否存在已知的云控制器组件,如果没有检测到就会显示如下的画面:
这里我们本来就要安装云控制器,所以保持空白不填,按回车继续。

在下面的屏幕中选择你希望安装的组件,这里我们要在一台机器上安装前端控制节点,所以选择除了虚拟机节点外的所有组件. 


在安装过程中,你需要配置你的云计算平台的基本信息:
首先是你的云集群名称,例如:cluster1
    • 然后是可供你的集群使用的公共 IP 地址池,分配给虚拟机实例的IP地址, e.g. 192.168.1.200-192.168.1.249. 如果在这里没有提供公共 IP 地址池,那么在启动虚拟机实例的时候就必须指定地址。
    • 安装后端虚拟机节点

    • 虚拟机的节点安装更简单,首先请一定确保前端控制服务器已经在网络中正常运行。
    • 首先在节点服务器上从光盘引导,选择“Install Ubuntu Enterprise Cloud”,只选择安装Node Controller. 
    • 注册节点控制器

    • 如果你正在用Ubuntu 10.04 LTS安装,那么可以跳过此步,Ubuntu 10.04 LTS会自动向已经找到的集群控制器注册该节点的。不过如果你是通过package的方式安装的,那么本步骤依然需要。
    • 交换公共SSH密钥

    • 云控制器的eucalyptus用户需要去访问其它控制服务器,它们之间的访问是通过Public SSH Key来完成的。由于这里所有前端的控制器都在一台上面,所以只需要将节点控制器的ssh key放到前端的云控制器上的俄服务器即可。
  • 在节点服务器上临时为eucalyptus用户加上密码:
    • sudo passwd eucalyptus
  • 然后在云控制器(Cloud Controller)上:
    • sudo -u eucalyptus ssh-copy-id -i ~eucalyptus/.ssh/id_rsa.pub eucalyptus@<IP_OF_NODE>
  • 最后将临时密码删除:
    • sudo passwd -d eucalyptus
    • 配置服务

    • 在云控制器( Cloud Controller)上:
  • 注册集群控制器( Cluster Controller ):
    • 定义集群名称: CC_NAME in /etc/eucalyptus/eucalyptus-cc.conf
    • 定义集群IP: CC_IP_ADDR in /etc/eucalyptus/eucalyptus-ipaddr.conf, 如果有多个集群服务器IP,用空格分隔.
  • 注册S3 Key-Value存储服务( Walrus Controller ):
    • 定义服务的IP地址: WALRUS_IP_ADDR in /etc/eucalyptus/eucalyptus-ipaddr.conf.

在集群控制器( Cluster Controller)上:
  • 注册Image存储控制器( Storage Controller ):
    • 定义集群名称: CC_NAME in /etc/eucalyptus/eucalyptus-cc.conf
    • 定义存储控制器的IP地址: SC_IP_ADDR in /etc/eucalyptus/eucalyptus-ipaddr.conf, 如果有多个存储服务器IP,用空格分隔.
    • 获取安全证书

    • 安装完毕,我们需要获取能够访问云计算平台安全证书来访问,云计算平台。
    • 浏览器访问

    • 首先我们可以从浏览器访问,访问云控制器的URL:
    • https://<cloud-controller-ip-address>:8443/
    • 注意你必须使用HTTPS安全连接访问。默认管理用户和密码为:admin/admin,第一次访问会让你填写修改密码等管理信息。

完成登录后,在Credentials页面上获取你的安全证书,点击“Download Credentials”下载你的云计算平台安全证书文件。
你也可以在云控制器服务器上直接用命令行的方式下载:

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


可以在服务器上运行下euca2tools中的命令看看证书是否正常:

. ~/.euca/eucarc
euca-describe-availability-zones verbose AVAILABILITYZONE   cluster1                     192.168.1.2 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


获取了安全证书你就可以开始使用了,比如获取或者创建操作系统Image, 开启虚拟机实例等等。接下来就是使用篇,由于本人巨懒,在教会韩同学后,就请我们文学有为青年韩同学以优美的文笔写了使用篇,我们大家都要感谢韩同学。
—————————————————————————————————————————