1、本帖最后由 cryboy2001 于 2014-08-15 14:52 编辑 目录 1、云计算与openstack介绍 传统的信息中心 云计算介绍 openstack介绍 物理架构 2、openstack架构 3、安装openstack方法 4、使用openstack 5、openstack配置文件 6、管理openstack 7、详解openstack 计算资源池 存储资源池 网络资源池 Glance镜像资源池 前端界面 Keystone认证管理 (不管会不会写完,象openstack一样,先把框架搞大点)
2、一、云计算与openstack介绍 1、传统的信息中心。当然下面画的很简单(自己画的),如果加上多个出口、设备冗余、线路冗余、服务器集群就会复杂。云计算就是用虚拟技术实现以下功能,如果理解了下面的网络功能,要理解openstack会很简单的,在openstack中都有与下面图中对应的模块。 缺点:1、部署应用时间长,工作量大,至少几个月2、资源利用率,有的服务器资源不够用,有的服务器大量资源浪费。2、管理复杂 3、扩展麻烦,灵活性差。等等,这些也是云计算的优点。 2、云计算介绍 云计算( Cloud Computing )是网格计算( Grid Computi
3、ng ) 、分布式计算 ( Distributed Computing ) 、并行计算( Parallel Computing ) 、效用计算( Utility Computing ) 、网络存储( Network Storage Technologies ) 、虚拟化( Virtualization ) 、负载均衡 ( Load Balance )等传统计算机技术(如以上图)和网络技术发展融合的产物。 个人理解:把一堆功能小的设备,整合成一大个功能强大设备,再把这个强大的设备划分成小设备,然后按你的需要买给你。 公用云(Public Cloud)、私有云(Priva
4、te Cloud)、混合云(Hybrid Cloud) 云计算解决方案:VMware vSphere、微软云计算解决方案、亚马逊AWS、OpenStack等等 3、openstack介绍 OpenStack是一个NASA和Rackspace2010年6月合作成立的,以Apache许可证授权,并且是一个自由软件和开放源代码项 目。OpenStack是一个云平台管理的项目,它不是一个软件,主要参考亚马逊AWS,由很多其他开源软件整合而成的。 - 以Python编程语言编写 - 整合Tornado网页服务器、Nebula运算平台
5、 - 使用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
6、年10月 发布Havana 2014年4月 发布‘Icehouse’ 最新版 得到了这么多公司的支持,能不成功吗? 4、物理架构 小到家里一台电脑(“家云”)、企业N多台(私有云)大到几千台信息中心(公有云)、openstack架构非常的大,可以包含VMware sphere、MS Hyper-V、SDN等。 二、openstack架构 openstack核心组成主要有 对象存储(Swift):通过key/value的方式实现对文件的存储,现在的云盘就是这样的 计算管理(Nova):提供虚拟主机,通过虚拟技术(kvm、
7、Xen、VMware等) 网络管理(Quantum):实现虚拟机的网络资源管理如网络连接、ip管理、公网映射 块存储(Cinder):为虚拟机提供存储,目前支持ip-san、fc-san等 镜像管理(Glance): 包含系统的存储空间 身份认证(Keystone):统一的授权、认证管理 界面(Horiaon):安装好后,用到的web网页的控制台DashBoard 上图网上找的,可能是台湾大牛画的,叫法稍有不同,相信大家能看懂的。 AMQP是整个openstack的核心,所有功能的实现,都是由AMQP与相应api接口交互。
8、三、安装openstack方法 现在openstack的安装方法非常的多,其中Devstack 、OneStack:、RDO都很简单,我这里是在一台服务器上Centos 6.5版下,用RDO allinone方式安装Icehouse 最新版。 官方文档也非常简单,就一页 1)最小化安装centos6.5 2)配置好网络能上网 3)设置主机名 要格式 #hostname #vi /etc/sysconfig/network HOSTNAME= 4)关掉selinux #vi /etc/selinux/config SELINU
9、X=disabled 5)改/etc/hosts #vi /etc/hosts 192.168.100.1 node 6)加源epel,与rdo,最好加一下163源 #yum -y install wget #wget 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.f
10、edorapeople.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 #这个文件时安装出错时产生的
11、 好了之后会出现如下: 安装看起来好简单哦,不过所有的事情,做起来就不会这么简单了。 下面是我安装时出现的各种错误。 大多原因是因为服务器在国外,国内安装会下载文件出问题造成的。 如果上面服务器只有一块网卡,是不能加浮动ip地址的(有人说可以),也就是可以产生虚拟机与虚拟网络,但不能与外部相连,所以我又备了一块网卡eth1。 vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 TYPE=OVSPort DEVICETYPE=ovs OVS_
12、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 本帖最后由 cryboy2001 于 2014-08-15 15:50 编
13、辑 四、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段) 上传镜像 云硬盘
14、 下面生成一台虚拟实例,能够上网,能通过外面的电脑ssh进入 进入项目----网络 添加私有网络 加路由加接口 得到的网络拓扑 加安全规责 创建云主机 浏览器直接用的novnc 自动得到的IP与ping openstack服务器 外网的一台主机,表明完全通了 外网ssh进入虚拟主机 挂载云硬盘 在云主机中挂载操作 本帖最后由 cryboy2001 于 2014-08-16 11:11 编辑 用linux总是离不开用命令行操作 加镜像 glance
15、 add name="
16、t 为虚拟机加浮动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
17、 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
18、 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 Pri
19、nt 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
20、 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. credent
21、ials 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 specifie
22、d 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
23、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 f
24、lavor-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.
25、 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.
26、 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 belon
27、ging 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 n
28、ew 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. key
29、pair-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 Migr
30、ates 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
31、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.
32、 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.
33、 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
34、 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 A
35、dd 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. s
36、ecgroup-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 s
37、erver. 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
38、 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 a
39、ll 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.
40、 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. 管理op
41、enstack 1、服务 在控制台系统信息中也能看到 OpenStack中Nova相关的服务 nova-compute:运行虚拟机实例最主要的服务。 nova-scheduler:管理调度服务器满足对运行虚拟机的请求。 nova-api:处理对OpenStack的请求,并运行相应的服务。 neutron:控制DHCP、DNS、路由的网络服务。 nova-objectstore:文件存储服务。 nova-common:OpenStack环境的基础Python库。 nova-cert:Nova证书管理服务,用来为Nova提供身份验证。 glance:镜像注册与传
42、输服务。 rabbitmq-server:消息队列服务。 mysql-server:保存所有OpenStack服务数据的数据库服务,例如可用的计算节点、实例状态等。 ntp:网络时间协议,它在多节点的环境中十分重要,可以让计算节点保持相同的时钟。 dnsmasq:前向DNS和DHCP服务,用来为实例分配地址。 2、日志 与openstack相关的日志都在 #ll /var/log drwxr-x--- 2 rabbitmq rabbitmq 4096 Aug 17 03:47 rabbitmq drwxr-xr-x 2 root root 4096 Au
43、g 17 03:47 openvswitch drwxr-x--- 2 nova nova 4096 Aug 17 03:47 nova drwxr-xr-x 2 neutron neutron 4096 Aug 17 03:47 neutron drwxr-x--- 2 keystone keystone 4096 Aug 17 03:47 keystone drwxr-xr-x 2 glance nobody 4096 Aug 17 03:47 glance drwxr-x--- 2 cinder root 4096 Aug 17 03:47 cinder drwxr-xr-x
44、 2 ceilometer root 4096 Aug 17 03:47 ceilometer drwxr-xr-x 2 mongodb root 4096 Aug 17 03:47 mongodb drwx------ 5 root root 4096 Aug 14 10:20 libvirt 要查看一个实例日志 3、监控与nagios 管理员---资源使用情况 中有服务器的监控 系统也已安装好了nagios http://192.168.0.218/nagios/ 密码在下面的位置 # cat /etc/nagios/passwd n
45、agiosadmin:eYuEUytV/nRpI nagios相关配置文件在,可以修改参数已达到资源使用到一定成度时或服务停止运行时报警。 #ll /etc/nagios total 96 -rw-rw-r-- 1 root root 11658 Aug 31 2013 cgi.cfg drwxr-x--- 2 root nagios 4096 Aug 31 2013 conf.d -rw------- 1 nagios root 141 Aug 14 10:30 keystonerc_admin -rw-rw-r-- 1 root root 44650 Aug 14 10:30
46、 nagios.cfg -rw-r--r-- 1 nagios nagios 1016 Aug 14 10:30 nagios_command.cfg -rw-r--r-- 1 nagios nagios 331 Aug 14 10:30 nagios_host.cfg -rw-r--r-- 1 nagios nagios 1295 Aug 14 10:30 nagios_service.cfg -rw-r--r-- 1 nagios nagios 8077 Aug 14 10:30 nrpe.cfg drwxr-x--- 2 root nagios 4096 Aug 14 10:3
47、0 objects -rw-r----- 1 root apache 27 Aug 14 10:30 passwd drwxr-x--- 2 root nagios 4096 Aug 14 10:30 private nogias界面 nogias监控内容 在命令行方式下也可以看到使用情况: 在数据库中也能找到 安装会出问题一般有以下几个方面: 1、平台,最小化安装,除非硬件有问题。 2、设置,只要按以上几个地方设就可以了。 3、网络传输中断,这个没办法,服务器在国外,没很好的方法,只要确认以上几点,最后坚信能成功
48、 如果是用最新的系统如centos 7,出现问题(bug)可在下面查 但这个也只是最新的临时解决方法,说出来也没什么意思,因为过几天可能就修正了。 如果出错还不行,就重复以上步骤, 也可以删除掉重来。 下面是rhel网上的全删除方法。 1. # Warning! Dangerous step! Destroys VMs 2. for x in $(virsh list --all | grep instance- | awk '{print $2}') ; do 3. virsh destroy $x ; 4. virsh und
49、efine $x ; 5. done ; 6. 7. # Warning! Dangerous step! Removes lots of packages, including many 8. # which may be unrelated to RDO. 9. yum remove -y nrpe "*nagios*" puppet ntp ntp-perl ntpdate "*openstack*" \ 10. "*nova*" "*keystone*" "*glance*" "*cinder*" "*swift*" \ 11. mysql mysql-server httpd "*memcache*" scsi-target-utils \ 12. iscsi-initiator-utils perl-DBI perl-DBD-MySQL ; 13. 14. ps -ef | grep -i repl






