第 6 步:源 keystonerc 文件
接下来,我们可以获取 keystoncerc 文件以获得更详细的 openstack-service 状态列表。
这个 keystonerc 文件将使用上面的 packstack 创建,并将在 root 的主文件夹中可用,如下所示
[root@controller-rhel ~]# ls -l keystonerc_admin -rw-------. 1 root root 229 Jan 7 22:57 keystonerc_admin [root@controller-rhel ~]# pwd /root [root@controller-rhel ~]# source keystonerc_admin
接下来再次检查状态
[root@controller-rhel ~(keystone_admin)]# openstack-status == Nova services == openstack-nova-api: active openstack-nova-cert: active openstack-nova-compute: inactive (disabled on boot) openstack-nova-network: inactive (disabled on boot) openstack-nova-scheduler: active openstack-nova-conductor: active == Glance services == openstack-glance-api: active openstack-glance-registry: active == Keystone service == openstack-keystone: inactive (disabled on boot) == Horizon service == openstack-dashboard: active == neutron services == neutron-server: active neutron-dhcp-agent: active neutron-l3-agent: active neutron-metadata-agent: active neutron-openvswitch-agent: active == Cinder services == openstack-cinder-api: active openstack-cinder-scheduler: active openstack-cinder-volume: active openstack-cinder-backup: inactive (disabled on boot) == Support services == mysqld: unknown libvirtd: active openvswitch: active dbus: active target: active rabbitmq-server: active memcached: active == Keystone users == +----------------------------------+---------+---------+-------------------+ | id | name | enabled | email | +----------------------------------+---------+---------+-------------------+ | e97f18a9994e4b99bcc0e6fe8db95cd3 | admin | True | root@localhost | | dccbaca5e2ee4866b343573678ec3bf7 | cinder | True | cinder@localhost | | 7dec80c93f8a4aafa1559a59e6bf606c | glance | True | glance@localhost | | 778e4fbefdfa4329bf9b7143ce6ffe74 | neutron | True | neutron@localhost | | e3d85ca8a8bb4ba5a9457712ce5814f5 | nova | True | nova@localhost | +----------------------------------+---------+---------+-------------------+ == Glance images == +----+------+ | ID | Name | +----+------+ +----+------+ == Nova managed services == +----+------------------+------------------------+----------+---------+-------+----------------------------+-----------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +----+------------------+------------------------+----------+---------+-------+----------------------------+-----------------+ | 1 | nova-consoleauth | controller-rhel.example| internal | enabled | up | 2015-07-07T18:02:59.000000 | - | | 2 | nova-scheduler | controller-rhel.example| internal | enabled | up | 2015-07-07T18:03:00.000000 | - | | 3 | nova-conductor | controller-rhel.example| internal | enabled | up | 2015-07-07T18:03:01.000000 | - | | 4 | nova-cert | controller-rhel.example| internal | enabled | up | 2015-07-07T18:02:57.000000 | - | | 5 | nova-compute | compute-rhel.example | nova | enabled | up | 2015-07-07T18:03:04.000000 | - | +----+------------------+------------------------+----------+---------+-------+----------------------------+-----------------+ == Nova networks == +----+-------+------+ | ID | Label | Cidr | +----+-------+------+ +----+-------+------+ == Nova instance flavors == +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ == Nova instances == +----+------+--------+------------+-------------+----------+ | ID | Name | Status | Task State | Power State | Networks | +----+------+--------+------------+-------------+----------+ +----+------+--------+------------+-------------+----------+
正如我们所看到的,它为我提供了所有 openstack 服务的详细状态。
现在我们可以登录horizon控制面板。
第 3 步:启动计算 VM
我的设置有一个具有 200GB 磁盘空间的磁盘,用于创建实例。
注意:实例使用的存储将在 /var/lib/glance 下,因此 /var 使用的任何分区都必须有一些空闲存储才能创建实例。
以下是我的设置片段
[root@compute-rhel ~]# lvs LV VG Attr LSize Pool Oroirn Data% Meta% Move Log Cpy%Sync Convert home rhel -wi-ao---- 134.49g root rhel -wi-ao---- 50.00g swap rhel -wi-ao---- 14.50g [root@compute-rhel ~]# pvs PV VG Fmt Attr PSize PFree /dev/vda2 rhel lvm2 a-- <199.00g 4.00m [root@compute-rhel ~]# vgs VG #PV #LV #SN Attr VSize VFree rhel 1 3 0 wz--n- <199.00g 4.00m [root@compute-rhel ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/rhel-root 50G 2.3G 48G 5% / devtmpfs 15G 0 15G 0% /dev tmpfs 15G 0 15G 0% /dev/shm tmpfs 15G 17M 15G 1% /run tmpfs 15G 0 15G 0% /sys/fs/cgroup /dev/vda1 1014M 131M 884M 13% /boot /dev/mapper/rhel-home 135G 33M 135G 1% /home tmpfs 2.9G 0 2.9G 0% /run/user/0 [root@compute-rhel ~]# free -g total used free shared buff/cache available Mem: 28 0 26 0 1 27 Swap: 14 0 14
准备工作
使用如下所示的命令禁用和停止以下服务
# systemctl stop NetworkManager # systemctl disable NetworkManager # systemctl stop firewalld # systemctl disable firewalld # systemctl restart network # systemctl enable network
注册并订阅必要的 Red Hat 频道,就像为控制器所做的那样
# subscription-manager register
在以下命令的输出中找到 Red Hat Enterprise Linux OpenStack Platform 的权利池:
# subscription-manager list --available --all
使用上一步中的池 ID 添加 Red Hat Enterprise Linux OpenStack Platform 权利:
# subscription-manager attach --pool=POOL_ID
禁用所有Repo
# subscription-manager repos --disable=*
接下来启用所有需要的存储库
# subscription-manager repos --enable=rhel-7-server-rh-common-rpms Repository 'rhel-7-server-rh-common-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-openstack-8-rpms Repository 'rhel-7-server-openstack-8-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-extras-rpms Repository 'rhel-7-server-extras-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-rpms Repository 'rhel-7-server-rpms' is enabled for this system.
步骤 1:启动物理主机服务器
首先,我们需要一个基础服务器,我们将在其上创建整个 Openstack 云。
- 接下来登录服务器并使用 Red Hat Subscription 进行注册
- 使用“应用程序安装程序”安装 Virtual Machine Manager(如果尚未安装)
- 接下来开始创建虚拟机,如以下章节所述
步骤 2:配置 BIND DNS 服务器
在配置 openstack 设置之前需要一个 DNS 服务器。
下面是我的配置文件示例
# cd /var/named/chroot/var/named
我的控制器和计算节点的转发配置文件
# cat example.zone $TTL 1D @ IN SOA example. root ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS example. IN A 127.0.0.1 IN A 10.43.138.12 openstack IN A 10.43.138.12 controller IN A 192.168.122.49 compute IN A 192.168.122.215 compute-rhel IN A 192.168.122.13 controller-rhel IN A 192.168.122.12
我的物理主机服务器托管 openstack 的反向区域文件
# cat example.rzone $TTL 1D @ IN SOA example. root.example. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS example. IN A 127.0.0.1 IN PTR localhost. 12 IN PTR openstack.example.
我的控制器和计算节点的反向区域文件
# cat openstack.rzone $TTL 1D @ IN SOA example. root.example. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS example. IN A 127.0.0.1 IN PTR localhost. 49 IN PTR controller.example. 215 IN PTR compute.example. 12 IN PTR controller-rhel.example. 13 IN PTR compute-rhel.example.
以下内容添加到 named.rfc1912.zones
zone "example" IN { type master; file "example.zone"; allow-update { none; }; }; zone "138.43.10.in-addr.arpa" IN { type master; file "example.rzone"; allow-update { none; }; }; zone "122.168.192.in-addr.arpa" IN { type master; file "openstack.rzone"; allow-update { none; }; };
OpenStack 项目,也称为云操作系统,由许多开发独立子系统的不同项目组成。
任何 OpenStack 安装都只能包含其中的一部分。
某些子系统甚至可以单独使用或者作为任何其他开源项目的一部分使用。
通过新项目的出现和现有项目的功能拆分,它们的数量随着 OpenStack 项目的不同版本而增加。
例如,nova-volume 服务被提取为一个单独的 Cinder 项目
确保在刀片上启用并支持管理程序
# grep -E ' svm | vmx' /proc/cpuinfo
我们应该在处理器支持的标志中看到 svm 或者 vmx。
此外,如果我们执行命令:
# lsmod | grep kvm kvm_intel 143187 3 kvm 455843 1 kvm_intel
或者
# lsmod | grep kvm kvm_amd 60314 3 kvm 461126 1 kvm_amd
我们应该看到内存中加载了两个内核模块。
kvm是独立于厂商的模块,kvm_intel或者kvm_amd分别执行VT-x或者AMD-V功能
第 4 步:启动控制器 VM
我已经分享了我的虚拟机的配置。
我不需要为控制器保留太多资源,因为它只会用于运行重要的 openstack 服务。
重要说明:我需要为 CINDER 服务创建一个另外的卷组,它可用于创建名为“cinder-volumes”的另外卷
因此,请确保在安装控制器节点时,创建一个具有足够空间的另外卷组“cinder-volumes”,对我而言,我提供了 100GB,用于在启动实例时添加另外的卷。
下面是我的设置片段
[root@controller-rhel ~]# pvs PV VG Fmt Attr PSize PFree /dev/vda3 rhel lvm2 a-- <38.52g <7.69g /dev/vdb1 cinder-volumes lvm2 a-- <100.00g <100.00g [root@controller-rhel ~]# vgs VG #PV #LV #SN Attr VSize VFree cinder-volumes 1 0 0 wz--n- <100.00g <100.00g rhel 1 2 0 wz--n- <38.52g <7.69g [root@controller-rhel ~]# lvs LV VG Attr LSize Pool Oroirn Data% Meta% Move Log Cpy%Sync Convert pool00 rhel twi-aotz-- 30.79g 15.04 11.48 root rhel Vwi-aotz-- 30.79g pool00 15.04 [root@controller-rhel ~]# free -g total used free shared buff/cache available Mem: 9 2 4 0 3 7 Swap: 0 0 0
准备工作
使用如下所示的命令禁用和停止以下服务
# systemctl stop NetworkManager # systemctl disable NetworkManager # systemctl stop firewalld # systemctl disable firewalld # systemctl restart network # systemctl enable network
注册服务器
# subscription-manager register
在以下命令的输出中找到 Red Hat Enterprise Linux OpenStack Platform 的权利池:
# subscription-manager list --available --all
使用上一步中的池 ID 添加 Red Hat Enterprise Linux OpenStack Platform 权利:
# subscription-manager attach --pool=POOL_ID
禁用所有Repo
# subscription-manager repos --disable=*
启用以下存储库(对于本文,我将使用 openstack-8)
# subscription-manager repos --enable=rhel-7-server-rh-common-rpms Repository 'rhel-7-server-rh-common-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-openstack-8-rpms Repository 'rhel-7-server-openstack-8-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-extras-rpms Repository 'rhel-7-server-extras-rpms' is enabled for this system. # subscription-manager repos --enable=rhel-7-server-rpms Repository 'rhel-7-server-rpms' is enabled for this system.
接下来安装packstack工具
# yum install -y openstack-packstack
接下来生成应答文件 /root/answers.txt 并查看生成的文件
# packstack --gen-answer-file ~/answer-file.txt
现在我们准备好创建和修改我们的答案文件以在我们的控制器和计算节点上部署 openstack 服务
第 5 步:创建答案文件并安装 Openstack
应答文件将具有不同的选项集,用于配置 openstack
以下是我为我的设置所做的更改。
完成后,是时候在控制器上执行 packstack 实用程序了,如下所示
[root@controller-rhel ~]# packstack --answer-file /root/answers.txt Welcome to the Packstack setup utility The installation log file is available at: /var/tmp/packstack/20150707-225026-DOdBB6/openstack-setup.log Installing: Clean Up [ DONE ] Discovering ip protocol version [ DONE ] Setting up ssh keys [ DONE ] Preparing servers [ DONE ] Pre installing Puppet and discovering hosts' details [ DONE ] ... 192.168.122.13_neutron.pp: [ DONE ] Applying 192.168.122.12_osclient.pp Applying 192.168.122.12_horizon.pp 192.168.122.12_osclient.pp: [ DONE ] 192.168.122.12_horizon.pp: [ DONE ] Applying 192.168.122.13_postscript.pp Applying 192.168.122.12_postscript.pp 192.168.122.12_postscript.pp: [ DONE ] 192.168.122.13_postscript.pp: [ DONE ] Applying Puppet manifests [ DONE ] Finalizing [ DONE ] Installation completed successfully ** Additional information: * File /root/keystonerc_admin has been created on OpenStack client host 192.168.122.12. To use the command line tools you need to source the file. * To access the OpenStack Dashboard browse to http://192.168.122.12/dashboard . Please, find your login credentials stored in the keystonerc_admin in your home directory. * The installation log file is available at: /var/tmp/packstack/20150707-225026-DOdBB6/openstack-setup.log * The generated manifests are available at: /var/tmp/packstack/20150707-225026-DOdBB6/manifests
如果一切顺利,那么我们应该会看到所有绿色,最后我们将获得指向仪表板的链接。
注意:如果我们需要更新配置,我们可以使用选项 -d 重新运行 PackStack。
安装 openstack-utils 以检查所有 openstack 服务的状态
# yum -y install openstack-utils
接下来检查状态
[root@controller-rhel ~]# openstack-status == Nova services == openstack-nova-api: active openstack-nova-cert: active openstack-nova-compute: inactive (disabled on boot) openstack-nova-network: inactive (disabled on boot) openstack-nova-scheduler: active openstack-nova-conductor: active == Glance services == openstack-glance-api: active openstack-glance-registry: active == Keystone service == openstack-keystone: inactive (disabled on boot) == Horizon service == openstack-dashboard: active == neutron services == neutron-server: active neutron-dhcp-agent: active neutron-l3-agent: active neutron-metadata-agent: active neutron-openvswitch-agent: active == Cinder services == openstack-cinder-api: active openstack-cinder-scheduler: active openstack-cinder-volume: active openstack-cinder-backup: inactive (disabled on boot) == Support services == mysqld: unknown libvirtd: active openvswitch: active dbus: active target: active rabbitmq-server: active memcached: active == Keystone users == Warning keystonerc not sourced
什么是应答文件(answer file)?
默认情况下,Packstack 提供了一个应答文件模板(answer file template),该模板可以在一个环境中部署一个多合一的环境,而无需对其进行自定义。
这些答案文件包括调整 Openstack 平台环境几乎所有方面的选项,包括架构布局、迁移到基于多个计算节点的部署,或者调整后端以用于 Cinder 和 Neutron 服务。
使用 PackStack 安装红帽 OpenStack 平台
Packstack 提供了一种在一台或者多台机器上部署 OpenStack Platform 环境的简单方法。
它可通过应答文件进行定制,应答文件包含一组允许对底层 Openstack 平台服务进行自定义配置的参数。