云平台encalyptus安装配置实践
实验配置
主机1:做front和node,安装clc,cc,nc;
主机2:做node,安装nc
1. 准备工作:
关闭selinux和防火墙
所有节点做时钟同步
#ntpdate pool.ntp.org
用yum安装gcc, java-1.6.0-openjdk, ant,ant-nodeps, dhcp, bridge-utils, httpd, swig等
#yum install scsi-target-utils
2. 安装软件eucalyptus
front: install the -cloud, -walrus, -cc and -sc RPMs
安装基础包
#rpm -Uvh aoetools-21-1.el4.i386.rpm \
euca-axis2c-1.6.0-1.i386.rpm \
euca-rampartc-1.3.0-1.i386.rpm \
vblade-14-1mdv2008.1.i586.rpm \
vtun-3.0.2-1.el5.rf.i386.rpm \
lzo2-2.02-3.el5.rf.i386.rpm \
perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.i386.rpm \
perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.i386.rpm \
perl-Crypt-X509-0.32-1.el5.rf.noarch.rpm \
python25-2.5.1-bashton1.i386.rpm \
python25-devel-2.5.1-bashton1.i386.rpm \
python25-libs-2.5.1-bashton1.i386.rpm
安装cloud,walrus,cc,sc
#rpm -Uvh eucalyptus-2.0.2-*.i386.rpm \
eucalyptus-common-java-2.0.2-1.i386.rpm \
eucalyptus-cloud-2.0.2-1.i386.rpm \
eucalyptus-walrus-2.0.2-1.i386.rpm \
eucalyptus-sc-2.0.2-1.i386.rpm \
eucalyptus-cc-2.0.2-1.i386.rpm \
eucalyptus-gl-2.0.2-1.i386.rpm
node:
安装基础包
#rpm -Uvh aoetools-21-1.el4.i386.rpm \
euca-axis2c-1.6.0-1.i386.rpm \
euca-rampartc-1.3.0-1.i386.rpm \
perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.i386.rpm \
perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.i386.rpm \
perl-Crypt-X509-0.32-1.el5.rf.noarch.rpm \
python25-2.5.1-bashton1.i386.rpm \
python25-devel-2.5.1-bashton1.i386.rpm \
python25-libs-2.5.1-bashton1.i386.rpm
安装nc
rpm -Uvh eucalyptus-2.0.2-*.i386.rpm \
eucalyptus-gl-2.0.2-1.i386.rpm \
eucalyptus-nc-2.0.2-1.i386.rpm
3、查看系统管理
virsh list
4. 编辑配置文件
在front和node节点上编辑/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 '')
重启xend restart
/etc/init.d/xend restart
frontend节点:
# groupadd libvirt
# vi /etc/libvirt/libvirtd.conf
unix_sock_group="libvirt"
unix_sock_ro_perms="0777"
unix_sock_rw_perms="0770"
auth_unix_ro="none"
auth_unix_rw="none"
# vi /etc/libvirt/qemu.conf
user="eucalyptus"
#chown root:libvirt /var/run/libvirt/libvirt-sock
#chown root:libvirt /var/run/libvirt/libvirt-sock-ro
重启libvirt
#/etc/init.d/libvirtd stop/start
#su eucalyptus -c "virsh list"成功
建立eucalyptus目录
# mkdir /home/eucalyptus
# chown eucalyptus:eucalyptus /home/eucalyptus
# chmod 700 /home/eucalyptus
5. 启动eucalyptus服务
frontend:
# /etc/init.d/eucalyptus-cloud start
# /etc/init.d/eucalyptus-cc status
node:
/etc/init.d/eucalyptus-nc start
Q: 启动cloud start失败,报异常:rg.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
A: LANG=zh_CN.utf8;export LANG
# euca_conf --register-walrus 221.7.248.180
ERROR: you need to be on the CLC host and the CLC needs to be running.
修改ssh可以root登录,以下需要输入ssh口令
注册frontend
euca_conf --register-walrus <front end IP address>
euca_conf --register-cluster mycluster 221.7.248.180
euca_conf --register-sc <clustername> <front end IP address>
[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
注册node
euca_conf --register-nodes "<Node 0 IP address> <Node 1 IP address> "
<Node 0 IP address>为运行NC的主机IP地址
--验证注册
euca_conf --list-walruses
euca_conf --list-clusters
euca_conf --list-scs
euca_conf --list-nodes
参考:《安装指南》http://wenku.baidu.com/view/91066a80e53a580216fcfe18.html
二. 安装后配置
1. 下载密钥和证书
在node节点上
从8443下载证书,上传到服务器上并解压
在Credentials分栏,点击“CredentialsZIP-file”下的“DownloadCredentials”按钮,下载euca2-admin-x509.zip到本地。
#mkdir ~/.euca
#cd ~/.euca
#chmod 0700 ~/.euca
#chmod 0600 ~/.euca/*
#. ~/.euca/eucarc
2. 修改网络配置
3. 创建image,似乎在一台机器上创建就可以。
下载image文件
注册成一个ubuntu-kernel-bucket,返回一个eki号为eki-xxxxxxxx
# euca-bundle-image -i vmlinuz-2.6.24-19-xen --kernel true
Checking image
Tarring image
Encrypting image
Splitting image...
Part: vmlinuz-2.6.24-19-xen.part.0
Generating manifest /tmp/vmlinuz-2.6.24-19-xen.manifest.xml 生成文件在/tmp目录
# euca-upload-bundle -b kernel -m /tmp/vmlinuz-2.6.24-19-xen.manifest.xml
Checking bucket: kernel
Creating bucket: kernel
Uploading manifest file
Uploading part: vmlinuz-2.6.24-19-xen.part.0
Uploaded image as kernel/vmlinuz-2.6.24-19-xen.manifest.xml
注册成一个ubuntu-ramdisk-bucket,返回一个eri号eri-xxxxxxxx
# euca-bundle-image -i initrd.img-2.6.24-19-xen --ramdisk true
Checking image
Tarring image
Encrypting image
Splitting image...
Part: initrd.img-2.6.24-19-xen.part.0
Generating manifest /tmp/initrd.img-2.6.24-19-xen.manifest.xml
# euca-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.24-19-xen.manifest.xml
Checking bucket: ubuntu-ramdisk-bucket
Creating bucket: ubuntu-ramdisk-bucket
Uploading manifest file
Uploading part: initrd.img-2.6.24-19-xen.part.0
Uploaded image as ubuntu-ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml
注册成一个ubuntu-image-bucket,返回一个emi号emi-xxxxxxxx
# euca-bundle-image -i centos.5-3.x86.img --kernel eki-F49510CB --ramdisk eri-AAE1178E
Checking image
Tarring image
Encrypting image
Splitting image...
Part: centos.5-3.x86.img.part.0
Part: centos.5-3.x86.img.part.22
Generating manifest /tmp/centos.5-3.x86.img.manifest.xml
# euca-upload-bundle -b ubuntu-image-bucket -m /tmp/centos.5-3.x86.img.manifest.xml
Checking bucket: ubuntu-image-bucket
Creating bucket: ubuntu-image-bucket
Uploading manifest file
Uploading part: centos.5-3.x86.img.part.0
Uploading part: centos.5-3.x86.img.part.22
Uploaded image as ubuntu-image-bucket/centos.5-3.x86.img.manifest.xml
注册
#euca-register kernel/vmlinuz-2.6.24-19-xen.manifest.xml
IMAGE eki-F49510CB
# euca-register ubuntu-ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml
IMAGE eri-AAE1178E
# euca-register ubuntu-image-bucket/centos.5-3.x86.img.manifest.xml
IMAGE emi-EB461524
euca-describe-images可以查看已注册成功的信息
# euca-describe-images -a
IMAGE eri-AAE1178E ubuntu-ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml admin available public x86_64 ramdisk instance-store
IMAGE eki-F49510CB kernel/vmlinuz-2.6.24-19-xen.manifest.xml admin available public x86_64 kernel instance-store
IMAGE emi-EB461524 ubuntu-image-bucket/centos.5-3.x86.img.manifest.xml admin available public x86_64 machine eki-F49510CB eri-AAE1178E instance-store
# euca-run-instances -k mykey -n 1 emi-EB461524 --addressing private 192.168.0.5
FinishedVerify: Not enough resources (0 < 1: vm instances.Not enough resources (0 < 1: vm instances.
解决办法:1. http://opensource.sys-con.com/node/1349819
2. /var/log/eucalyptus中的日志
#euca-describe-instances
#euca-terminate-instances <instance-id1> running->shuttingdown->terminate
登录VM
http://open.eucalyptus.com/wiki/EucalyptusGettingStarted_v1.6
Q:oxs defualt error , The extenension index of NID_subject_key_identifier is not valid
A:解决办法:可以忽略
Q:Nil value found in non-nillable property nodeStatus
A:
#euca-describe-availability-zones verbose
在front上#euca-describe-availability-zones verbose
No parsers found
解决办法:# yum install PyXML 仍未解决
cd ~/.euca
#euca-add-keypair mykey > mykey.private
euca-allocate-address
euca-authorize -P tcp -p 22 -s 0.0.0.0/0 default
修改eucalyptus配置文件
Whenever you make some changes in eucalyptus.conf file, you should cleanstop/cleanstart the CC.
/etc/init.d/eucalyptus-cc cleanstop
/etc/init.d/eucalyptus-cc cleanstart