1、本帖最后由 cryboy2001 于 2014-08-15 14:52 编辑目录1、云计算与openstack介绍传统的信息中心云计算介绍openstack介绍物理架构2、openstack架构3、安装openstack方法4、使用openstack5、openstack配置文件6、管理openstack7、详解openstack计算资源池存储资源池网络资源池Glance镜像资源池前端界面Keystone认证管理(不管会不会写完,象openstack一样,先把框架搞大点)一、云计算与openstack介绍1、传统的信息中心。当然下面画的很简单(自己画的),如果加上多个出口、设备冗余、线路冗余、
2、服务器集群就会复杂。云计算就是用虚拟技术实现以下功能,如果理解了下面的网络功能,要理解openstack会很简单的,在openstack中都有与下面图中对应的模块。缺点:1、部署应用时间长,工作量大,至少几个月2、资源利用率,有的服务器资源不够用,有的服务器大量资源浪费。2、管理复杂 3、扩展麻烦,灵活性差。等等,这些也是云计算的优点。2、云计算介绍云计算( Cloud Computing )是网格计算( Grid Computing) 、分布式计算 ( DistributedComputing ) 、并行计算( ParallelComputing ) 、效用计算( UtilityComput
3、ing ) 、网络存储( Network Storage Technologies ) 、虚拟化( Virtualization ) 、负载均衡 ( Load Balance )等传统计算机技术(如以上图)和网络技术发展融合的产物。个人理解:把一堆功能小的设备,整合成一大个功能强大设备,再把这个强大的设备划分成小设备,然后按你的需要买给你。公用云(Public Cloud)、私有云(Private Cloud)、混合云(Hybrid Cloud)云计算解决方案:VMware vSphere、微软云计算解决方案、亚马逊AWS、OpenStack等等3、openstack介绍OpenStack是一
4、个NASA和Rackspace2010年6月合作成立的,以Apache许可证授权,并且是一个自由软件和开放源代码项目。OpenStack是一个云平台管理的项目,它不是一个软件,主要参考亚马逊AWS,由很多其他开源软件整合而成的。 - 以Python编程语言编写 - 整合Tornado网页服务器、Nebula运算平台 - 使用Twisted软件框架 - 遵循Open Virtualization Format、AMQP、SQLAlchemy等标准 - 虚拟机器软件支援包括:KVM、Xen、VirtualBox、VMware、Hyper-V版本发布以ABC顺序,很好记。2010年10月发布Aust
5、in2011年2月 发布Bexar2011年4月 发布Cactus2011年7月 发布Diablo2012年4月 发布Essex2012年10月 发布Folsom2013年4月 发布Grizzly2013年10月发布Havana2014年4月发布Icehouse最新版得到了这么多公司的支持,能不成功吗?4、物理架构小到家里一台电脑(“家云”)、企业N多台(私有云)大到几千台信息中心(公有云)、openstack架构非常的大,可以包含VMware sphere、MS Hyper-V、SDN等。二、openstack架构openstack核心组成主要有对象存储(Swift):通过key/value
6、的方式实现对文件的存储,现在的云盘就是这样的计算管理(Nova):提供虚拟主机,通过虚拟技术(kvm、Xen、VMware等)网络管理(Quantum):实现虚拟机的网络资源管理如网络连接、ip管理、公网映射块存储(Cinder):为虚拟机提供存储,目前支持ip-san、fc-san等镜像管理(Glance): 包含系统的存储空间身份认证(Keystone):统一的授权、认证管理界面(Horiaon):安装好后,用到的web网页的控制台DashBoard上图网上找的,可能是台湾大牛画的,叫法稍有不同,相信大家能看懂的。AMQP是整个openstack的核心,所有功能的实现,都是由AMQP与相应
7、api接口交互。三、安装openstack方法现在openstack的安装方法非常的多,其中Devstack 、OneStack:、RDO都很简单,我这里是在一台服务器上Centos 6.5版下,用RDO allinone方式安装Icehouse最新版。官方文档也非常简单,就一页1)最小化安装centos6.52)配置好网络能上网3)设置主机名 要格式#hostname #vi /etc/sysconfig/networkHOSTNAME=4)关掉selinux#vi /etc/selinux/configSELINUX=disabled5)改/etc/hosts#vi /etc/hosts1
8、92.168.100.1node6)加源epel,与rdo,最好加一下163源#yum -y installwget#wgetmv CentOS6-Base-163.repo /etc/yum.rope/CentOS-Base.repoyum -y installhttp:/dl.fedoraproject.org/pub/ . ase-6-8.noarch.rplm#yum install -yhttp:/rdo.fedorapeople.org/rdo-release.rpm#yum clean all#yum makecache7)更新#yum -y update更新好了后一定要重启电脑
9、8)安装openstack#yum install -y openstack-packstack#packstack -allinone如果中断了,找到问题后,再安装用# packstack -answer-file /root/packstack-answers-20140807-131342.txt#这个文件时安装出错时产生的好了之后会出现如下:安装看起来好简单哦,不过所有的事情,做起来就不会这么简单了。下面是我安装时出现的各种错误。大多原因是因为服务器在国外,国内安装会下载文件出问题造成的。如果上面服务器只有一块网卡,是不能加浮动ip地址的(有人说可以),也就是可以产生虚拟机与虚拟网络,
10、但不能与外部相连,所以我又备了一块网卡eth1。vi /etc/sysconfig/network-scripts/ifcfg-eth1DEVICE=eth1TYPE=OVSPortDEVICETYPE=ovsOVS_BRIDGE=br-exONBOOT=yesHWADDR=00:50:45:02:8A:55# vi /etc/sysconfig/network-scripts/ifcfg-br-exDEVICE=br-exDEVICETYPE=ovsTYPE=OVSBridgeBOOTPROTO=staticIPADDR=192.168.10.100NETMASK=255.255.255.0
11、ONBOOT=yes重启网络以后的浮动ip网段我就用192.168.10.0/24本帖最后由 cryboy2001 于 2014-08-15 15:50 编辑四、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段
12、)上传镜像云硬盘下面生成一台虚拟实例,能够上网,能通过外面的电脑ssh进入进入项目-网络 添加私有网络加路由加接口得到的网络拓扑加安全规责创建云主机浏览器直接用的novnc自动得到的IP与ping openstack服务器 外网的一台主机,表明完全通了外网ssh进入虚拟主机挂载云硬盘在云主机中挂载操作本帖最后由 cryboy2001 于 2014-08-16 11:11 编辑用linux总是离不开用命令行操作加镜像glance add name= is_public=true container_format=ovf disk_format=qcow2 .imgnova image-list查
13、看查看虚拟机类型nova flavor-list查看可用网络nova network-list生成一个实例要用到以上的镜像、虚拟机类型、和可用网络nova boot -flavor 1 -image cirros -nic net-id=037c1fa2-3f35-4cab-a229-c236380f4a7bcmdtest为虚拟机加浮动ipnova add-floating-ip cmdtest 192.168.10.24查看生成的虚拟机nova show cmdtest利用浮动ip,从公网ssh进入加一10G云盘nova volume-create -display_name vdisk10
14、 10nova volume-listnova 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 Se
15、curity Group to a server. aggregate-add-hostAdd 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 aggr
16、egates. aggregate-remove-host Remove the specified host from the specifiedaggregate. aggregate-set-metadata Update the metadata associated with the aggregate. aggregate-update Update the aggregates name and optionallyavailability zone. boot Boot a new server. cloudpipe-create Create a cloudpipe inst
17、ance 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
18、server diagnostics. dns-create Create a DNS entry for domain, name and ip. dns-create-private-domainCreate the specified DNS domain. dns-create-public-domainCreate the specified DNS domain. dns-delete Delete the specified DNS entry. dns-delete-domain Delete the specified DNS domain. dns-domains Prin
19、t 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 theauthenticate services fixed-ip-get Show information for a fixed IP fixed-ip-reserve Reserve a fixed IP fixed-ip-unreserveUnreserve fixed I
20、P 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-createAllocate a floating IP for the current tena
21、nt. floating-ip-deleteDe-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 al
22、l hosts by service host-update Update host settings. hypervisor-list List hypervisors. hypervisor-serversList 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 hyperv
23、isor-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 t
24、he 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
25、 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-updateUpdate the quotas for a quota
26、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
27、address from a server. remove-floating-ipRemove 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. res
28、ize-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 g
29、roup. 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. servic
30、e-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
31、 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-sn
32、apshot-list List all the snapshots. volume-snapshot-show Show details about a snapshot. volume-type-createCreate a new volume type. volume-type-deleteDelete 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-ro
33、ot-certFetches the x509 root cert.管理openstack1、服务在控制台系统信息中也能看到OpenStack中Nova相关的服务nova-compute:运行虚拟机实例最主要的服务。nova-scheduler:管理调度服务器满足对运行虚拟机的请求。nova-api:处理对OpenStack的请求,并运行相应的服务。neutron:控制DHCP、DNS、路由的网络服务。nova-objectstore:文件存储服务。nova-common:OpenStack环境的基础Python库。nova-cert:Nova证书管理服务,用来为Nova提供身份验证。glan
34、ce:镜像注册与传输服务。rabbitmq-server:消息队列服务。mysql-server:保存所有OpenStack服务数据的数据库服务,例如可用的计算节点、实例状态等。ntp:网络时间协议,它在多节点的环境中十分重要,可以让计算节点保持相同的时钟。dnsmasq:前向DNS和DHCP服务,用来为实例分配地址。2、日志与openstack相关的日志都在#ll/var/logdrwxr-x- 2 rabbitmq rabbitmq 4096 Aug 17 03:47 rabbitmqdrwxr-xr-x 2 root root 4096 Aug 17 03:47 openvswitchd
35、rwxr-x- 2 nova nova 4096 Aug 17 03:47 novadrwxr-xr-x 2 neutron neutron 4096 Aug 17 03:47 neutrondrwxr-x- 2 keystone keystone 4096 Aug 17 03:47 keystonedrwxr-xr-x 2 glance nobody 4096 Aug 17 03:47 glancedrwxr-x- 2 cinder root 4096 Aug 17 03:47 cinderdrwxr-xr-x 2 ceilometer root 4096 Aug 17 03:47 ceil
36、ometerdrwxr-xr-x 2 mongodb root 4096 Aug 17 03:47 mongodbdrwx- 5 root root 4096 Aug 14 10:20 libvirt要查看一个实例日志3、监控与nagios管理员-资源使用情况 中有服务器的监控系统也已安装好了nagioshttp:/192.168.0.218/nagios/密码在下面的位置# cat /etc/nagios/passwdnagiosadmin:eYuEUytV/nRpInagios相关配置文件在,可以修改参数已达到资源使用到一定成度时或服务停止运行时报警。#ll /etc/nagiostota
37、l 96-rw-rw-r- 1 root root 11658 Aug 31 2013 cgi.cfgdrwxr-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 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:
38、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.cfgdrwxr-x- 2 root nagios 4096 Aug 14 10:30 objects-rw-r- 1 root apache 27 Aug 14 10:30 passwddrwxr-x- 2 root nagios 4096 Aug 14 10:30 privatenogias界面nogias监控内容在命令行方式下也可以看到使
39、用情况:在数据库中也能找到安装会出问题一般有以下几个方面:1、平台,最小化安装,除非硬件有问题。2、设置,只要按以上几个地方设就可以了。3、网络传输中断,这个没办法,服务器在国外,没很好的方法,只要确认以上几点,最后坚信能成功。如果是用最新的系统如centos 7,出现问题(bug)可在下面查但这个也只是最新的临时解决方法,说出来也没什么意思,因为过几天可能就修正了。如果出错还不行,就重复以上步骤,也可以删除掉重来。下面是rhel网上的全删除方法。1. # Warning! Dangerous step! Destroys VMs2. for x in $(virsh list -all |
40、grep instance- | awk print $2) ; do3. virsh destroy $x ;4. virsh undefine $x ;5. done ;6.7. # Warning! Dangerous step! Removes lots of packages, including many8. # 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