openstack笔记 4

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
简介: openstack笔记

7、同步nova-api数据库

[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova

8、注册cell数据库

[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova


9、创建cell1单元表

[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --
name=cell1 --verbose" nova
108a6e6f-c68c-465f-b4bd-a83d0d13b277


10、填充nova数据库

[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
# 忽略输出的启用信息


11、检查novacell0cell1是否注册正确

[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+--------------------------------
----------+-------------------------------------------------+----------+
| Name | UUID | Transport URL
| Database Connection | Disabled |
+-------+--------------------------------------+--------------------------------
----------+-------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/
| mysql+pymysql://nova:****@controller/nova_cell0 | False |
| cell1 | 108a6e6f-c68c-465f-b4bd-a83d0d13b277 |
rabbit://openstack:****@controller:5672/ |
mysql+pymysql://nova:****@controller/nova | False |
+-------+--------------------------------------+--------------------------------
----------+-------------------------------------------------+----------+

12、启动服务

[root@controller ~]# systemctl enable \
openstack-nova-api \
openstack-nova-scheduler \
openstack-nova-conductor \
openstack-nova-novncproxy
[root@controller ~]# systemctl start \
openstack-nova-api \
openstack-nova-scheduler \
openstack-nova-conductor \
openstack-nova-novncproxy
[root@controller ~]# systemctl status \
openstack-nova-api \
openstack-nova-scheduler \
openstack-nova-conductor \
openstack-nova-novncproxy

下面在compute执行

13、安装软件包

14、修改nova配置文件

编辑/etc/nova/nova.conf文件,完成如下操作:

[DEFAULT]部分,只启用计算和元数据api:

[DEFAULT]
enabled_apis = osapi_compute,metadata
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis
osapi_compute,metadata

[DEFAULT]部分,配置RabbitMQ消息队列访问:

[DEFAULT]
transport_url = rabbit://openstack:000000@controller
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf DEFAULT transport_url
rabbit://openstack:000000@controller

[api][keystone_authtoken]部分中,配置身份服务访问:

[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 000000
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf api auth_strategy keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken
www_authenticate_uri http://controller:5000/
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url
http://controller:5000/
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers
controller:11211
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken
project_domain_name Default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name
Default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name
service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password 000000

[DEFAULT]部分,配置my_ip选项:

[DEFAULT]
my_ip = 192.168.75.21
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.75.21

[DEFAULT]部分,启用对网络服务的支持:

[DEFAULT]
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver
nova.virt.firewall.NoopFirewallDriver

[vnc]部分,启用并配置远程控制台访问:

[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = 192.168.75.20
novncproxy_base_url = http://192.168.75.20:6080/vnc_auto.html
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf vnc enabled true
openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address
192.168.75.21
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url
http://192.168.75.20:6080/vnc_auto.html

In the [glance] section, configure the location of the Image service API:

[glance]
api_servers = http://controller:9292
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf glance api_servers
http://controller:9292

In the [oslo_concurrency] section, configure the lock path:

[oslo_concurrency]
lock_path = /var/lib/nova/tmp
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path
/var/lib/nova/tmp

In the [placement] section, configure the Placement API:

placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = 000000
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf placement region_name RegionOne
openstack-config --set /etc/nova/nova.conf placement project_domain_name Default
openstack-config --set /etc/nova/nova.conf placement project_name service
openstack-config --set /etc/nova/nova.conf placement auth_type password
openstack-config --set /etc/nova/nova.conf placement user_domain_name Default
openstack-config --set /etc/nova/nova.conf placement auth_url
http://controller:5000/v3
openstack-config --set /etc/nova/nova.conf placement username placement
openstack-config --set /etc/nova/nova.conf placement password 000000

15、确定计算节点是否支持虚拟机的硬件加速

[root@compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
0
# 如果此命令返回的值为1或更大,则表示计算节点支持硬件加速,这通常不需要额外的配置。
# 如果此命令返回值为0,则表示计算节点不支持硬件加速,必须将libvirt配置为使用QEMU而不是KVM。

编辑/etc/nova/nova.conf文件中的[libvirt]部分。

[libvirt]
virt_type = qemu
# 使用下面的命令可直接修改
openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu

16、启动服务

[root@compute ~]# systemctl enable libvirtd.service openstack-novacompute.service
[root@compute ~]# systemctl start libvirtd.service openstack-novacompute.service

17、将计算节点添加到单元格数据库中

在控制节点执行

[root@controller ~]# source admin-openrc
[root@controller ~]# openstack compute service list --service nova-compute
+----+--------------+---------+------+---------+-------+------------------------
----+
| ID | Binary | Host | Zone | Status | State | Updated At
|
+----+--------------+---------+------+---------+-------+------------------------
----+
| 7 | nova-compute | compute | nova | enabled | up | 2023-06-
07T08:43:07.000000 |
+----+--------------+---------+------+---------+-------+------------------------
----+
# 发现计算主机
[root@controller ~]# 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': 108a6e6f-c68c-465f-b4bd-a83d0d13b277
Checking host mapping for compute host 'compute': b73acc61-300e-4a9b-99bf-
6151507b5759
Creating host mapping for compute host 'compute': b73acc61-300e-4a9b-99bf-
6151507b5759
Found 1 unmapped computes in cell: 108a6e6f-c68c-465f-b4bd-a83d0d13b277

18、验证

[root@controller ~]# nova-status upgrade check
Error:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 398, in main
ret = fn(*fn_args, **fn_kwargs)
File "/usr/lib/python2.7/site-packages/oslo_upgradecheck/upgradecheck.py",
line 102, in check
result = func(self)
File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 164, in
_check_placement
versions = self._placement_get("/")
File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 154, in
_placement_get
return client.get(path, raise_exc=True).json()
File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 386, in
get
return self.request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 248, in
request
return self.session.request(url, method, **kwargs)
File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 961, in
request
raise exceptions.from_response(resp, method, url)
Forbidden: Forbidden (HTTP 403)

解决办法

# 在/etc/httpd/conf.d/00-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服务
[root@controller ~]# systemctl restart httpd
# 在次执行文件
[root@controller ~]# nova-status upgrade check
+------------------------------------------------------------------+
| Upgrade Check Results |
+------------------------------------------------------------------+
| Check: Cells v2 |
| Result: Failure |
| Details: No host mappings found but there are compute nodes. Run |
| command 'nova-manage cell_v2 simple_cell_setup' and then |
| retry. |
+------------------------------------------------------------------+
| Check: Placement API |
| Result: Success |
| Details: None |
+------------------------------------------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success |
| Details: None |
+------------------------------------------------------------------+
| Check: Cinder API |
| Result: Success |
| Details: None |
六、安装neutron服务
1、创建数据库
2、获取admin凭证
3、创建neutron用户
+------------------------------------------------------------------+
相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
消息中间件 安全 Linux
openstack笔记 5
openstack笔记
|
消息中间件 Oracle 关系型数据库
openstack笔记 3
openstack笔记
|
存储 API 数据安全/隐私保护
openstack笔记 7
openstack笔记
108 0
|
消息中间件 Linux 网络安全
openstack笔记 6
openstack笔记
111 0
|
存储 前端开发 数据库
openstack笔记 2
openstack笔记
|
消息中间件 网络协议 网络安全
openstack笔记 1
openstack笔记
140 0
|
网络协议 Linux 网络安全
openstack 云平台一体化部署(超详细)
openstack 云平台一体化部署(超详细)
1349 0
openstack 云平台一体化部署(超详细)
|
4月前
|
消息中间件 缓存 Shell
跟我一起来学OpenStack部署
跟我一起来学OpenStack部署
351 0
|
5月前
|
存储 数据安全/隐私保护 Docker
Kolla-ansible部署openStack
Kolla-ansible部署openStack
461 11