Eucalyptus云平台搭建

来源:互联网 发布:男王升级数据 编辑:程序博客网 时间:2024/05/16 12:53

【系统配置】

两台电脑,装上centos 6.4系统。一个作为front,一个作为nodeFrontIP地址为10.103.241.99nodeIP地址为10.103.241.126

node节点配置网桥  yum -y install bridge-utils

编辑文件/etc/sysconfig/network-scripts/ifcfg-p4p1

DEVICE=p4p1

ONBOOT=yes

NM_CONTROLLED="no"

TYPE=Ethernet

DEFROUTE=yes

#BOOTPROTO=static

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System p4p1"

UUID=2d907eae-84b7-49b8-b061-5c941a38096a

PREFIX=20

HWADDR=5C:F9:DD:5F:34:C8

BRIDGE=br0

(大部分电脑应该是ifcfg-eth0,因为我用的是笔记本作为node,而笔记本本来没有相应的以太网网卡驱动,我是在网上下载的一个驱动,所以名字为ifcfg-p4p1,其实只是名字不同而已。还有的驱动名字为emi)

编辑文件/etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0

TYPE=Bridge

BOOTPROTO=static

ONBOOT=yes

IPADDR=10.103.241.126

NETMASK=255.255.240.0

GATEWAY=10.103.240.1

DNS1=10.3.9.4

DELAY=0

STP=off

配置网桥主要命令

1,创建网桥设备 br0 

brctl addbr br0

2, br0中添加网卡

brctl addif eth0

brctl addif p4p1

3, 从网桥中删除网卡

brctl delif eth0

brctl delif p4p1

4, 删除网桥br0

brctl delbr br0

5, 查看网桥是否存在逻辑(虚拟)网桥接口

brctl show

如果删除出现错误,显示br0正在使用

则用 ifconfig    br0   down

关闭系统防火墙并配置SELinux

运行下面的命令,并在弹出的界面中取消已经启用的防火墙:

system-config-firewall-tui

编辑/etc/selinux/config,SELINUX设置为disabled

运行下面的命令使如上配置生效

setenforce 0

 

配置NTP

1yum install ntp

2,打开/etc/ntp.conf文件会看到如下几行

server 0.centos.pool.ntp.org

server 1.centos.pool.ntp.org

server 2.centos.pool.ntp.org

3chkconfig ntpd on

4service ntpd start

5ntpdate -u 0.centos.pool.ntp.org

0.centos.pool.ntp.org是你的ntp服务器的地址

6hwclock --systohc

 

Eucalyptus安装】

首先安装Eucalyptus软件源

yum install http://downloads.eucalyptus.com/software/eucalyptus/ 3.3 /centos/6/x86_64/eucalyptus-release- 3.3 .noarch.rpm

yum install http://downloads.eucalyptus.com/software/euca2ools/ 3.0 /centos/6/x86_64/euca2ools-release- 3.0 .noarch.rpm

yum install http://downloads.eucalyptus.com/software/eucalyptus/ 3.3 /centos/6/x86_64/epel-release-6.noarch.rpm

yum install http://downloads.eucalyptus.com/software/eucalyptus/ 3.3 /centos/6/x86_64/elrepo-release-6.noarch.rpm

接着在front安装Eucalyptus云控制器和各个组件

yum install eucalyptus-cloud

yum install eucalyptus-cc eucalyptus-sc eucalyptus-walrus

node安装Eucalyptus节点

1yum install eucalyptus-nc

2,确保kvm有合适的权限

ls -l /dev/kvm

crw-rw-rw- 1 root kvm 10, 232 Nov 30 10:27 /dev/kvm

确保用户为root组为kvm

【网络环境的配置】

使用Managed(No-VLAN)模式

CC Configuration

1,打开/etc/eucalyptus/eucalyptus.conf文件

2,到Network Configuration部分,取消以下备注并设置

VNET_MODE="MANAGED-NOVLAN"

VNET_SUBNET="[Subnet for VMs private IPs. Example: 192.168.0.0]"

VNET_NETMASK="[Netmask for the vnet_subnet. Example: 255.255.0.0]"

VNET_DNS="[DNS server IP]"

VNET_ADDRSPERNET="[Number of simultaneous instances per security group]"

VNET_PUBLICIPS="[Free public IP 1] [Free public IP 2] ..."

VNET_LOCALIP="[IP address that other CCs can use to reach this CC]"

VNET_DHCPDAEMON="[Path to DHCP daemon binary. Example: /usr/sbin/dhcpd3]"

VNET_DHCPUSER='[DHCP user. Example: dhcpd]"

 

VNET_PRIVINTERFACE="[Ethernet device on same network as NCs. Example: eth1]"

VNET_PUBINTERFACE="[Ethernet device on public’ network. Example: eth0]"

NC Configuration

1,打开/etc/eucalyptus/eucalyptus.conf文件

2,到Network Configuration部分,取消以下备注并设置

VNET_MODE="MANAGED-NOVLAN"

VNET_BRIDGE="[bridge name. Example: br0]"

 

【初始化并开启服务】

/usr/sbin/euca_conf  --initialize

service eucalyptus-cloud start

service eucalyptus-cc start

service eucalyptus-nc start

【注册各个组件】

/usr/sbin/euca_conf --register-walrus --partition walrus --host 10.103.241.99 --component walrus-wyp

/usr/sbin/euca_conf --register-cluster --partition clusterwyp01 --host 10.103.241.99 --component cc-wyp

/usr/sbin/euca_conf --register-nodes “10.103.241.126”

 

至此安装配置完毕

 

【使用】

用如下命令来获得管理员用户的授权资料

/usr/sbin/euca_conf --get-credentials admin.zip

解压缩,设置环境变量

unzip admin.zip

source eucarc

【下载虚拟机镜像】

eustore-describe-images命令查看Eustore上公开发布的虚拟机镜像

用下面的命令下载

Eustore-install-image -i 3868652036 -s “centos 5.9 x86_64” -b centos_5.9 --hypervisor kvm

 

【管理门户】

通过浏览器访问https://10.103.241.99:8443,第一次登陆时,用户名和密码分别为eucalyptusadmin,系统会强制要求你修改密码

 

 

【用户门户】

Eucalyptus的用户门户是需要单独安装的,安装很简单,只需要一个命令

yum install eucalyptus-console

不需要进行任何配置,用户门户就可以使用,如果你需要中文界面,编辑/etc/eucalyptus-console/console.ini,修改language设置为zh_CN即可

如果你修改了任何配置,需要重新启动eucalyptus-console服务

service eucalyptus-console restart

 

 

 

【创建实例】

1,下载证书:将下载的证书放在.euca文件夹下,.euca可以放在root下,也可以放在root的其他文件夹下

mkdir  ~/.euca

cd     ~/.euca

unzip name-of-the-key-zip.zip

chmod  0700  ~/.euca

chmod  0600  ~/.euca/*

source  ~/.euca/eucarc

2Creating Keypairs

euca-create-keypair  wyp-key > wyp-key.private

chmod  0600  wyp-key.private

euca-describe-keypairs

3,创建实例

euca-run-instances  emi-EC1410C1  -k  wyp-key

这步注意是wyp-key而不是wyp-key.private,如果直接用Tab自动补齐的话就很容易写成wyp-key.private,这个时候会出现找不到keypair的错误

4,查看实例状态

euca-describe-instances

5,登陆虚拟机

euca-authorize  -P  tcp  -p  22  -s  0.0.0.0/0  default

ssh  -i  wyp-key.private  root@<accessible-instance-ip>

【常用命令】

euca_conf  --list-walruses

euca_conf  --list-clusters

euca_conf  --list-scs

euca_conf  --list-nodes

 

euca-describe-images

euca-describe-instances

euca-describe-availability-zones  verbose

euca-describe-keypairs

 

euca-run-instances  -k  mykey  -n  1  -t  m1.small  emi-C78D3879

Euca-create-keypair  euca-demo > euca-demo.private

service  eucalyptus-cloud  start

service  eucalyptus-cc  start

service  eucalyptus-nc  start

service  eucalyptus-cc  cleanrestart

 

eustore-describe-images

eustore-install-image  -i  3868652036  -s  “centos 5.9 x86_64”  -b  centos_5.9  --hypervisor  kvm

 

grep  -v  “^#”  /etc/eucalyptus/eucalyptus.conf  |  sort  -u

 

【常见错误】

1SC未注册成功

Solutionconfiguring the SC to use the local file system

1) euca-modify-property  -p  <partition>.storage.blocks  toragemanager=overlay

2) Euca-describe-properties  |  grep blockstorage

配置前2)显示为unset,配置后2)显示为overlay

2,网桥配置不成功

为了网桥顺利工作,需要关闭NetworkManager,因为NetworkManager好像不支持网桥启动,这个服务关闭后,电脑右上角就不再显示网上邻居类似的管理网络连接的图标了

chkconfig  NetworkManager  off

service  NetworkManager  stop

chconfig  --level  35  network  on

3euca_conf  --list-nodes显示

NODE  clusterwyp01  10.103.241.126  NOTREADY

Solution:在NC节点 service  eucalyptus-nc  restart

vim  /etc/hosts  添加一行

10.103.241.126    wyp.node

wyp.node 是主机名

 

注意,首先要确保服务全部开启,FrontNode之间连通,其次才可以创建实例。做接下来的工作。

 


0 0
原创粉丝点击