打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
图解openstack
本帖最后由 cryboy2001 于 2014-08-15 14:52 编辑

http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4150203&extra=page%3D1%26filter%3Dtypeid%26typeid%3D523%26typeid%3D523
目录

1、云计算与openstack介绍
传统的信息中心
云计算介绍
openstack介绍
物理架构

2、openstack架构

3、安装openstack方法

4、使用openstack

5、openstack配置文件

6、管理openstack

7、详解openstack
计算资源池
存储资源池
网络资源池
Glance镜像资源池
前端界面
Keystone认证管理

(不管会不会写完,象openstack一样,先把框架搞大点)


一、云计算与openstack介绍

1、传统的信息中心。当然下面画的很简单(自己画的),如果加上多个出口、设备冗余、线路冗余、服务器集群就会复杂。云计算就是用虚拟技术实现以下功能,如果理解了下面的网络功能,要理解openstack会很简单的,在openstack中都有与下面图中对应的模块。



缺点:1、部署应用时间长,工作量大,至少几个月2、资源利用率,有的服务器资源不够用,有的服务器大量资源浪费。2、管理复杂 3、扩展麻烦,灵活性差。等等,这些也是云计算的优点。

2、云计算介绍

云计算( Cloud Computing )是网格计算( Grid Computing  ) 、分布式计算 ( Distributed  Computing ) 、并行计算( Parallel  Computing ) 、效用计算( Utility  Computing ) 、网络存储( Network Storage Technologies ) 、虚拟化( Virtualization ) 、负载均衡 ( Load Balance )等传统计算机技术(如以上图)和网络技术发展融合的产物。

个人理解:把一堆功能小的设备,整合成一大个功能强大设备,再把这个强大的设备划分成小设备,然后按你的需要买给你。


公用云(Public Cloud)、私有云(Private Cloud)、混合云(Hybrid Cloud)

云计算解决方案:VMware vSphere、微软云计算解决方案、亚马逊AWS、OpenStack等等

3、openstack介绍



OpenStack是一个NASA和Rackspace2010年6月合作成立的,以Apache许可证授权,并且是一个自由软件和开放源代码项

目。OpenStack是一个云平台管理的项目,它不是一个软件,主要参考亚马逊AWS,由很多其他开源软件整合而成的。


    - 以Python编程语言编写
    - 整合Tornado网页服务器、Nebula运算平台
    - 使用Twisted软件框架
    - 遵循Open Virtualization Format、AMQP、SQLAlchemy等标准
    - 虚拟机器软件支援包括:KVM、Xen、VirtualBox、VMware、Hyper-V

版本发布以ABC顺序,很好记。
2010年10月  发布‘Austin’
2011年2月   发布‘Bexar’
2011年4月   发布‘Cactus’
2011年7月   发布‘Diablo’
2012年4月   发布‘Essex’
2012年10月 发布‘Folsom’
2013年4月 发布‘Grizzly’
2013年10月  发布Havana
2014年4月  发布‘Icehouse’  最新版


得到了这么多公司的支持,能不成功吗?


4、物理架构

小到家里一台电脑(“家云”)、企业N多台(私有云)大到几千台信息中心(公有云)、openstack架构非常的大,可以包含VMware sphere、MS Hyper-V、SDN等。




二、openstack架构

openstack核心组成主要有

对象存储(Swift):通过key/value的方式实现对文件的存储,现在的云盘就是这样的

计算管理(Nova):提供虚拟主机,通过虚拟技术(kvm、Xen、VMware等)

网络管理(Quantum):实现虚拟机的网络资源管理如网络连接、ip管理、公网映射

块存储(Cinder):为虚拟机提供存储,目前支持ip-san、fc-san等

镜像管理(Glance):    包含系统的存储空间

身份认证(Keystone):统一的授权、认证管理

界面(Horiaon):安装好后,用到的web网页的控制台DashBoard


上图网上找的,可能是台湾大牛画的,叫法稍有不同,相信大家能看懂的。



AMQP是整个openstack的核心,所有功能的实现,都是由AMQP与相应api接口交互。

三、安装openstack方法

现在openstack的安装方法非常的多,其中Devstack 、OneStack:、RDO都很简单,我这里是在一台服务器上Centos 6.5版下,用RDO allinone方式安装Icehouse  最新版。

官方文档也非常简单,就一页http://openstack.redhat.com/Quickstart

1)最小化安装centos6.5

2)配置好网络能上网

3)设置主机名 要node.test.com格式

#hostname node.test.com

#vi /etc/sysconfig/network

HOSTNAME=node.test.com

4)关掉selinux

#vi /etc/selinux/config

SELINUX=disabled

5)改/etc/hosts

#vi /etc/hosts

192.168.100.1  node  node.test.com

6)加源epel,与rdo,最好加一下163源

#yum -y install  wget

#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

mv CentOS6-Base-163.repo /etc/yum.rope/CentOS-Base.repo

yum -y install http://dl.fedoraproject.org/pub/ ... ase-6-8.noarch.rplm

#yum install -y  http://rdo.fedorapeople.org/rdo-release.rpm

#yum clean all

#yum makecache

7)更新

#yum -y update

更新好了后一定要重启电脑

8)安装openstack

#yum install -y openstack-packstack

#packstack --allinone

如果中断了,找到问题后,再安装用

# packstack --answer-file /root/packstack-answers-20140807-131342.txt  #这个文件时安装出错时产生的

好了之后会出现如下:





安装看起来好简单哦,不过所有的事情,做起来就不会这么简单了。

下面是我安装时出现的各种错误。







大多原因是因为服务器在国外,国内安装会下载文件出问题造成的。

如果上面服务器只有一块网卡,是不能加浮动ip地址的(有人说可以),也就是可以产生虚拟机与虚拟网络,但不能与外部相连,所以我又备了一块网卡eth1。

vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
ONBOOT=yes
HWADDR=00:50:45:02:8A:55
# vi /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.10.100
NETMASK=255.255.255.0
ONBOOT=yes
重启网络

以后的浮动ip网段我就用192.168.10.0/24四、openstak使用
密码在/root/下
-rw------- 1 root root 183 Aug 12 17:12 keystonerc_admin
-rw------- 1 root root 180 Aug 12 17:12 keystonerc_demo
这两个文件中,自带的2个用户admin与demo。



项目与管理员及下面的目录



1、在dashboard中,管理员下修改网络功能、加镜像、改云主机类型,云硬盘。然后要部署应用在项目中进行。

加外网(浮动ip段)




上传镜像

云硬盘


下面生成一台虚拟实例,能够上网,能通过外面的电脑ssh进入
进入项目----网络 添加私有网络



加路由加接口


得到的网络拓扑


加安全规责


创建云主机



浏览器直接用的novnc  自动得到的IP与ping openstack服务器 外网的一台主机,表明完全通了



外网ssh进入虚拟主机



挂载云硬盘


在云主机中挂载操作
 
用linux总是离不开用命令行操作

加镜像

glance add name="<Image name>" is_public=true container_format=ovf disk_format=qcow2 < <filename>.img
nova image-list  查看
查看虚拟机类型
nova flavor-list
查看可用网络
nova network-list


生成一个实例要用到以上的镜像、虚拟机类型、和可用网络

nova boot --flavor 1 --image cirros --nic net-id=037c1fa2-3f35-4cab-a229-c236380f4a7b  cmdtest

为虚拟机加浮动ip

nova add-floating-ip cmdtest 192.168.10.24

查看生成的虚拟机

nova show cmdtest





利用浮动ip,从公网ssh进入



加一10G云盘

nova volume-create --display_name vdisk10 10

nova volume-list

nova volume-attach cmdtest vdisk10 /dev/vdb

可看到已加成功,可分区挂载使用了



附其它命令

nova     
     absolute-limits     Print a list of absolute limits for a user
     actions             Retrieve server actions.
     add-fixed-ip        Add new IP address to network.
     add-floating-ip     Add a floating IP address to a server.
     add-secgroup        Add a Security Group to a server.
     aggregate-add-host  Add the host to the specified aggregate.
     aggregate-create    Create a new aggregate with the specified details.
     aggregate-delete    Delete the aggregate by its id.
     aggregate-details   Show details of the specified aggregate.
     aggregate-list      Print a list of all aggregates.
     aggregate-remove-host    Remove the specified host from the specified  aggregate.
     aggregate-set-metadata Update the metadata associated with the aggregate.
     aggregate-update    Update the aggregate's name and optionally  availability zone.
     boot                Boot a new server.
     cloudpipe-create    Create a cloudpipe instance for the given project
     cloudpipe-list      Print a list of all cloudpipe instances.
     cloudpipe-update Update a cloudpipe instance
     console-log         Get console log output of a server.
     credentials         Show user credentials returned from auth
     delete              Immediately shut down and delete a server.
     diagnostics         Retrieve server diagnostics.
     dns-create          Create a DNS entry for domain, name and ip.
     dns-create-private-domain  Create the specified DNS domain.
     dns-create-public-domain  Create the specified DNS domain.
     dns-delete          Delete the specified DNS entry.
     dns-delete-domain   Delete the specified DNS domain.
     dns-domains         Print a list of available dns domains.
     dns-list            List current DNS entries for domain and ip or domain and name.
     endpoints           Discover endpoints that get returned from the  authenticate services
     fixed-ip-get        Show information for a fixed IP
     fixed-ip-reserve    Reserve a fixed IP
     fixed-ip-unreserve  Unreserve fixed IP
     flavor-create       Create a new flavor
     flavor-delete       Delete a specific flavor
     flavor-key          Set or unset extra_spec for a flavor.
     flavor-list         Print a list of available 'flavors' (sizes of servers).
     flavor-show         Show details about the given flavor.
     floating-ip-create  Allocate a floating IP for the current tenant.
     floating-ip-delete  De-allocate a floating IP.
     floating-ip-list    List floating ips for this tenant.
     floating-ip-pool-list List all floating ip pools.
     get-vnc-console     Get a vnc console to a server.
     host-action         Perform a power action on a host.
     host-describe       Describe a specific host
     host-list           List all hosts by service
     host-update         Update host settings.
     hypervisor-list     List hypervisors.
     hypervisor-servers  List instances belonging to specific hypervisors.
     hypervisor-show     Display the details of the specified hypervisor.
     hypervisor-stats    Get hypervisor statistics over all compute nodes.[cpu,mem]
     hypervisor-uptime   Display the uptime of the specified hypervisor.
     image-create        Create a new image by taking a snapshot of a running server.
     image-delete        Delete an image.
     image-list          Print a list of available images to boot from.
     image-meta          Set or Delete metadata on an image.
     image-show          Show details about the given image.
     keypair-add         Create a new key pair for use with instances
     keypair-delete      Delete keypair by its id
     keypair-list        Print a list of keypairs for a user
     list                List active servers.
     list-extensions List available extensions
     live-migration      Migrates a running instance to a new machine.
     lock                Lock a server.
     meta                Set or Delete metadata on a server.
     migrate             Migrate a server.
     network-list        Print a list of available networks.
     network-show        Show details about the given network.
     pause               Pause a server.
     quota-class-show    List the quotas for a quota class.
     quota-class-update  Update the quotas for a quota class.
     quota-defaults      List the default quotas for a tenant.
     quota-show          List the quotas for a tenant.
     quota-update        Update the quotas for a tenant.
     rate-limits         Print a list of rate limits for a user
     reboot              Reboot a server.
     rebuild             Shutdown, re-image, and re-boot a server.
     remove-fixed-ip     Remove an IP address from a server.
     remove-floating-ip  Remove a floating IP address from a server.
     remove-secgroup     Remove a Security Group from a server.
     rename              Rename a server.
     rescue              Rescue a server.
     reset-state         Reset the state of an instance
     resize              Resize a server.
     resize-confirm      Confirm a previous resize.
     resize-revert       Revert a previous resize (and return to the previous VM).
     resume              Resume a server.
     root-password       Change the root password for a server.
     secgroup-add-group-rule
     Add a source group rule to a security group.
     secgroup-add-rule   Add a rule to a security group.
     secgroup-create     Create a security group.
     secgroup-delete     Delete a security group.
     secgroup-delete-group-rule
     Delete a source group rule from a security group.
     secgroup-delete-rule
     Delete a rule from a security group.
     secgroup-list       List security groups for the current tenant.
     secgroup-list-rules
     List rules for a security group.
     service-list        List nova services
     show                Show details about the given server.
     ssh                 SSH into a server.
     start               Start a server.
     stop                Stop a server.
     suspend             Suspend a server.
     unlock              Unlock a server.
     unpause             Unpause a server.
     unrescue            Unrescue a server.
     usage-list          List usage data for all tenants
     volume-attach       Attach a volume to a server.
     volume-create       Add a new volume.
     volume-delete       Remove a volume.
     volume-detach       Detach a volume from a server.
     volume-list         List all the volumes.
     volume-show         Show details about a volume.
     volume-snapshot-create      Add a new snapshot.
     volume-snapshot-delete      Remove a snapshot.
     volume-snapshot-list      List all the snapshots.
     volume-snapshot-show       Show details about a snapshot.
     volume-type-create  Create a new volume type.
     volume-type-delete  Delete a specific flavor.
     volume-type-list    Print a list of available 'volume types'.
     x509-create-cert    Create x509 cert for a user in tenant.
     x509-get-root-cert  Fetches the x509 root cert.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
IP Reputation Investigation
!!!六星级 浏览器目录清理指南 信息图 Clear Browsing Data Cheat Sheet
STL容器的使用
rabbitmq和erlang卸载
380. Insert Delete GetRandom O(1) - Medium
python3 根据元素名删除列表元素
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服