天天看点

Eucalyptus常用命令示例

Eucalyptus云技术专题(专题五)

Amazon云计算开源实现之Eucalyptus——Eucalyptus常用命令示例

1 系统查询 

查看可用的资源域

euca-describe-availability-zones verbose 

描述密钥

euca-describe-keyparis 

列出Eucalyptus中实例信息

euca-describe-instances 

列出Eucalyptus中可用镜像

euca-describe-images 

列出Eucalyptus中的volume

euca-describe-volumes 

2 创建密钥

euca-add-keypair mykey > mykey.private 

chmod 0600 mykey.private 

3 启动一个实例

euca-run-instances -k key -n 1 -t m1.small emi-xxxxxxxx 

-k 参数是在安装euca2ools时申请导入的keypair.private

-n 参数是需要启动的实例个数

-t 参数是实例类型:m1.small,c1,medium,m1.large,m1.xlarge,c1.xlarge

emi-xxxxxxxx 是实例的镜像

4 终止或重启一个实例

euca-terminate-instances i-xxxxxxxxx 

euca-reboot-instances i-xxxxxxxx 

5 创建和挂载volume

euca-create-volume -S size -Z zone 

size 表示创建volume的大小

zone 表示volume所在的cluster

euca-attach-volume -i instance -d device volume_id 

instance 表示要挂载的实例ID

device 表示实例中的设备号,如sdb1等

volume_id 表示要挂载的volume的ID号 

6 上传Eucalyptus镜像

6.1 打包Eucalyptus镜像文件

euca-bundle-image -i 文件 --kernel -true 

打包内核文件:参数为--kernel -true

打包引导文件:参数为--randisk -true

打包系统镜像:参数为--kernel $EKI --ramdisk $ERI,其中EKI和ERI是代表要绑定的内核镜像ID和引导镜像ID

6.2 上传打包好的Eucalyptus镜像文件

euca-upload-bundle -b bucket -m manifest 

bucket 是在服务器存储镜像的文件名,需要自己定义

manifest 是euca-bundle-image 生成的 xxxxxxx.manifest.xml文件

6.2 注册已上传Eucalyptus镜像文件

euca-registerbucket-file/xxxxxxx.manifest.xml 

参数为euca-upload-bundle 命令行中最后生成的manifest.xml文件路径

Eucalyptus常用命令一览

<a href="http://blog.51cto.com/attachment/201304/083909656.jpg" target="_blank"></a>

本文转自清风拂面 51CTO博客,原文链接:http://blog.51cto.com/crazy123/1178307