本文为扶艾原创文章,版权所有,禁止转载!
本篇文章是本系列的第四篇文章,将继续进行OpenStack计算服务的安装
五、安装计算服务
5.1 (控制节点)配置数据库
- 连接数据库
# mysql -u root -pfuai123
- 创建nova相关数据库并设置访问权限
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
IDENTIFIED BY 'fuai123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
IDENTIFIED BY 'fuai123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIED BY 'fuai123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIED BY 'fuai123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
IDENTIFIED BY 'fuai123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
IDENTIFIED BY 'fuai123';
5.2 (控制节点)创建nova认证相关信息
- 设置admin环境变量
# . admin-openrc
- 创建nova用户
密码我设置的fuai123
# openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 1cde1ce579c241a5906684adba106d93 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
- 给nova用户添加admin角色
# openstack role add --project service --user nova admin
- 创建nova服务
# openstack service create --name nova \
--description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 01ffdb12a467441a94d0f3aba7b85136 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
- 创建计算api端口
# openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 88c9171ba5ee481c9031f59c18e72d8e |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 01ffdb12a467441a94d0f3aba7b85136 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
# openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 53121a04b0f14da69a13dcb8323c0304 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 01ffdb12a467441a94d0f3aba7b85136 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
# openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 31e7047e34104204aeddca406a534b81 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 01ffdb12a467441a94d0f3aba7b85136 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
- 创建placement服务用户
密码我设置的fuai123
# openstack user create --domain default --password-prompt placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | cef9b0bd33a14f20b375f864f148822f |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
- 添加placement用户到服务项目
# openstack role add --project service --user placement admin
- 创建placement api服务
# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Placement API |
| enabled | True |
| id | 4822cd7e915a4470aeecbc24643a5ee8 |
| name | placement |
| type | placement |
+-------------+----------------------------------+
- 创建placement api服务端口
# openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 848bc5a3161a4de88cc3ac77964487ad |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4822cd7e915a4470aeecbc24643a5ee8 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
# openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | fe72f5f0207840c6a05a836955179941 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4822cd7e915a4470aeecbc24643a5ee8 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
# openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 13fc18d3fe6a422c8e0008522ae9c617 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4822cd7e915a4470aeecbc24643a5ee8 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
5.3 (控制节点)安装软件包并配置组件
- 安装软件包
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api -y
- 编辑/etc/nova/nova.conf文件并完成以下配置
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:fuai123@controller
my_ip = 192.168.0.77
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
...
[api_database]
connection = mysql+pymysql://nova:fuai123@controller/nova_api
...
[database]
connection = mysql+pymysql://nova:fuai123@controller/nova
...
[api]
auth_strategy = keystone
...
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = fuai123
...
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
...
[glance]
api_servers = http://controller:9292
...
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
...
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = fuai123
...
- 因为软件包的bug,编辑/etc/httpd/conf.d/00-nova-placement-api.conf文件增加如下内容
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
- 重启httpd服务
# systemctl restart httpd
- 导入相关数据库表结构
# su -s /bin/sh -c "nova-manage api_db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
c354ac0-a088-4dbb-b106-e795ebeaec32
# su -s /bin/sh -c "nova-manage db sync" nova
- 验证cell0和cell1是否成功注册
# nova-manage cell_v2 list_cells
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
| 名称 | UUID | Transport URL | 数据库连接 |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller/nova_cell0 |
| cell1 | fc354ac0-a088-4dbb-b106-e795ebeaec32 | rabbit://openstack:****@controller | mysql+pymysql://nova:****@controller/nova |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
- 设置服务的开机自启动,并启动服务
# systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
5.4 (计算节点)在计算节点安装计算服务
- 安装软件包
# yum install openstack-nova-compute -y
- 编辑/etc/nova/nova.conf文件并设置如下内容
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:fuai123@controller
my_ip = 192.168.0.78
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
...
[api]
auth_strategy = keystone
...
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = fuai123
...
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://192.168.0.77:6080/vnc_auto.html
...
[glance]
api_servers = http://controller:9292
...
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
...
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = fuai123
...
- 检测当前计算节点是否支持硬件虚拟化
我使用的虚拟机,这里返回0,明显我不支持硬件虚拟化
# egrep -c '(vmx|svm)' /proc/cpuinfo
0
- 编辑/etc/nova/nova.conf文件设置qemu来提供软件虚拟化
[libvirt]
virt_type = qemu
...
- 设置服务的开机自启动,并启动计算服务
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
5.5 (控制节点)向cell数据库添加计算节点
- 添加admin环境变量
# . admin-openrc
- 执行下面的命令,查看计算节点信息是否已经在数据库
# openstack compute service list --service nova-compute
+----+--------------+---------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+--------------+---------+------+---------+-------+----------------------------+
| 6 | nova-compute | compute | nova | enabled | up | 2018-04-26T12:00:40.000000 |
+----+--------------+---------+------+---------+-------+----------------------------+
- 发现计算节点
# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell 'cell1': fc354ac0-a088-4dbb-b106-e795ebeaec32
Checking host mapping for compute host 'compute': 47b0f376-fa1a-4fe8-9f2e-af1be125781a
Creating host mapping for compute host 'compute': 47b0f376-fa1a-4fe8-9f2e-af1be125781a
Found 1 unmapped computes in cell: fc354ac0-a088-4dbb-b106-e795ebeaec32
5.6 (控制节点)验证操作
- 添加admin环境变量
# . admin-openrc
- 列出计算服务的运行状态
# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller | internal | enabled | up | 2018-04-26T12:10:00.000000 |
| 2 | nova-conductor | controller | internal | enabled | up | 2018-04-26T12:09:59.000000 |
| 5 | nova-scheduler | controller | internal | enabled | up | 2018-04-26T12:10:00.000000 |
| 6 | nova-compute | compute | nova | enabled | up | 2018-04-26T12:10:00.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
- 列出认证服务的端口
# openstack catalog list
+-----------+-----------+-----------------------------------------+
| Name | Type | Endpoints |
+-----------+-----------+-----------------------------------------+
| nova | compute | RegionOne |
| | | admin: http://controller:8774/v2.1 |
| | | RegionOne |
| | | internal: http://controller:8774/v2.1 |
| | | RegionOne |
| | | public: http://controller:8774/v2.1 |
| | | |
| placement | placement | RegionOne |
| | | admin: http://controller:8778 |
| | | RegionOne |
| | | public: http://controller:8778 |
| | | RegionOne |
| | | internal: http://controller:8778 |
| | | |
| glance | image | RegionOne |
| | | internal: http://controller:9292 |
| | | RegionOne |
| | | admin: http://controller:9292 |
| | | RegionOne |
| | | public: http://controller:9292 |
| | | |
| keystone | identity | RegionOne |
| | | public: http://controller:5000/v3/ |
| | | RegionOne |
| | | admin: http://controller:35357/v3/ |
| | | RegionOne |
| | | internal: http://controller:5000/v3/ |
| | | |
+-----------+-----------+-----------------------------------------+
- 列出镜像信息,确认能访问镜像服务
# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 0466e837-7d0c-4ebd-a2a1-194e80635d98 | cirros | active |
+--------------------------------------+--------+--------+
- 确认cells和placement api成功运行
# nova-status upgrade check
+--------------------------+
| 升级检查结果 |
+--------------------------+
| 检查: Cells v2 |
| 结果: 成功 |
| 详情: None |
+--------------------------+
| 检查: Placement API |
| 结果: 成功 |
| 详情: None |
+--------------------------+
| 检查: Resource Providers |
| 结果: 成功 |
| 详情: None |
+--------------------------+
至此,OpenStack计算服务已经安装验证完成,下面将进行网络服务等组件的安装,具体请参见文章《OpenStack(Queens)详细安装部署(五)》
更多精彩内容,OpenStack干货请扫描下方二维码,关注我们微信公众号“扶艾”!

本文详细介绍了如何在OpenStack Queens版本中安装部署计算服务(nova),包括配置数据库、创建认证信息、安装软件包、设置计算节点以及验证操作的全过程。
详细安装部署(四)-计算服务(nova)安装&spm=1001.2101.3001.5002&articleId=80188231&d=1&t=3&u=020cd2dce1da4fa2a4f11eb2127390a0)
1万+

被折叠的 条评论
为什么被折叠?



