OpenStack部署(二)

OpenStack部署

    • 4. Glance
      • 4.1 创建Glance数据库并授权
      • 4.2 获得admin凭证
      • 4.3 创建glance用户并设置密码
      • 4.4 添加 admin 角色到 glance 用户和 service 项目上
      • 4.5 创建glance服务实体
      • 4.6 创建镜像服务的 API 端点
      • 4.7 yum安装Glance服务
      • 4.8 初始化镜像服务的数据库
      • 4.9 启动镜像服务、配置他们开机启动
      • 4.10 验证镜像
    • 5. Nova
      • 5.1 创建Nova数据库并授权
      • 5.2 获得admin凭证
      • 5.3 创建nova并设置密码
      • 5.4 给nova用户添加admin角色
      • 5.5 创建 nova 服务实体
      • 5.6 创建 Compute 服务 API 端点
      • 5.7 创建placement并设置密码
      • 5.8 给 placement 用户添加 admin 角色
      • 5.9 创建 placement 服务实体
      • 5.10 创建 placement 服务 API 端点
      • 5.11 Nova 控制节点安装与配置
      • 5.12 重启httpd服务
      • 5.13 同步Nova数据库
      • 5.14 验证nova cell0和cell1是否正确注册
      • 5.15 启动 Compute 服务并将其设置为随系统启动
      • 5.16 安装并配置计算节点
      • 5.17 启动计算服务及其依赖,并将其配置为随系统自动启动
      • 5.18 验证操作
        • 1. 发现计算主机操作
        • 2. 确认数据库中是否有计算主机
        • 3. 列出服务组件以验证每个进程的成功启动和注册
        • 4. 列出身份服务中的API端点以验证与身份服务的连接
        • 5. 列出Image服务中的图像以验证与Image服务的连接性
        • 6. 检查cells和placement API是否成功运行

OpenStack部署(二)_第1张图片

4. Glance

OpenStack镜像服务器是一套虚拟机镜像发现、注册、检索系统

4.1 创建Glance数据库并授权

[root@node-251 openstack]# openssl rand -hex 10
b7bce025bc10257f83c3
[root@node-251 openstack]# mysql -u root -p

mysql> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER glance@'%' IDENTIFIED BY 'b7bce025bc10257f83c3';
Query OK, 0 rows affected (0.01 sec)

mysql> Grant all privileges on glance.* to 'glance'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

4.2 获得admin凭证

[root@node-251 openstack]# source admin-openrc

4.3 创建glance用户并设置密码

[root@node-251 openstack]# openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled             | True                             |
| id                  | e04616f866a94348a434d781ffca72f5 |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

密码:123456

4.4 添加 admin 角色到 glance 用户和 service 项目上

[root@node-251 openstack]# openstack role add --project service --user glance admin

4.5 创建glance服务实体

[root@node-251 openstack]# openstack service create --name glance --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | ef27852fef98441fb6be59a9d792b667 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+

4.6 创建镜像服务的 API 端点

[root@node-251 openstack]# openstack endpoint create --region RegionOne image public http://openstack.if010.com:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 71e771f1d99b494aa669aeb2a2ef62aa |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ef27852fef98441fb6be59a9d792b667 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://openstack.if010.com:9292  |
+--------------+----------------------------------+
[root@node-251 openstack]# ^C
[root@node-251 openstack]# openstack endpoint create --region RegionOne image internal http://openstack.if010.com:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f74ee2f7e4544d8ca4eb11a7fc12d164 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ef27852fef98441fb6be59a9d792b667 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://openstack.if010.com:9292  |
+--------------+----------------------------------+
[root@node-251 openstack]# openstack endpoint create --region RegionOne image admin http://openstack.if010.com:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 936e7fe99b9e4caa82d9c0fa4f6e7557 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ef27852fef98441fb6be59a9d792b667 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://openstack.if010.com:9292  |
+--------------+----------------------------------+

4.7 yum安装Glance服务

[root@node-251 openstack]# yum install -y openstack-glance python-glance python-glanceclient

配置 /etc/glance/glance-api.conf 文件

[root@node-251 openstack]# cat /etc/glance/glance-api.conf|grep -v '^$'|grep -v '^#'
[DEFAULT]
[cors]
[database]													#配置数据库访问
connection = mysql+pymysql://glance:[email protected]/glance
[glance_store]												#配置本地文件系统存储和镜像文件位置
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images
[image_format]
[keystone_authtoken]										#配置认证服务访问
auth_uri = http://openstack.if010.com:5000
auth_url = http://openstack.if010.com:35357
memcached_servers = openstack.if010.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 123456    								#glance用户的密码
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]												#配置认证的方式
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]

配置 /etc/glance/glance-registry.conf 文件

[root@node-251 openstack]# cat /etc/glance/glance-registry.conf|grep -v '^$'|grep -v '^#'
[DEFAULT]
[database]
connection = mysql+pymysql://glance:[email protected]/glance
[keystone_authtoken]
auth_uri = http://openstack.if010.com:5000
auth_url = http://openstack.if010.com:35357
memcached_servers = openstack.if010.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 123456
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]

4.8 初始化镜像服务的数据库

[root@node-251 openstack]# su -s /bin/sh -c "glance-manage db_sync" glance
...
Database is synced successfully.

4.9 启动镜像服务、配置他们开机启动

[root@node-251 openstack]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[root@node-251 openstack]# systemctl restart openstack-glance-api.service openstack-glance-registry.service

4.10 验证镜像

下载镜像,如果无法下载,可更换其他镜像

[root@node-251 openstack]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

QCOW2磁盘格式bare 容器格式上传镜像到镜像服务并设置公共可见,这样所有的项目都可以访问它

[root@node-251 openstack]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2023-06-06T03:46:14Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/45d98b6f-3f42-48dc-a0b3-cab7a27fb8d5/file |
| id               | 45d98b6f-3f42-48dc-a0b3-cab7a27fb8d5                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | 2aaf4155b00749b0a333a039c17c131c                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 13287936                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2023-06-06T03:46:14Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+
[root@node-251 openstack]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 45d98b6f-3f42-48dc-a0b3-cab7a27fb8d5 | cirros | active |
+--------------------------------------+--------+--------+

5. Nova

计算服务是openstack最核心的服务之一,而Nova组件负责维护和管理云环境的计算资源

Nova自身并没有提供任何虚拟化能力,它提供计算服务,使用不同的虚拟化驱动来与底层支持的Hypervisor (虚拟机管理器)进行交互。所有的计算实例(虚拟服务器)由Nova进行生命周期的调度管理(启动、挂起、停止、删除等)

Nova需要keystone, glance, neutron, cinder和swift等其他服务的支持,能与这些服务集成,实现如加密磁盘、裸金属计算实例等。

5.1 创建Nova数据库并授权

[root@openstack ~]# openssl rand -hex 10
e528734fc653231683c9

mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;

CREATE USER nova_api@'%' IDENTIFIED BY 'e528734fc653231683c9';
Grant all privileges on nova_api.* to 'nova_api'@'%';

CREATE USER nova@'%' IDENTIFIED BY 'e528734fc653231683c9';
Grant all privileges on nova.* to 'nova'@'%';

CREATE USER nova_cell0@'%' IDENTIFIED BY 'e528734fc653231683c9';
Grant all privileges on nova_cell0.* to 'nova_cell0'@'%';

flush privileges;

5.2 获得admin凭证

source admin-openrc

5.3 创建nova并设置密码

[root@node-251 openstack]# openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled             | True                             |
| id                  | db36aad1e5bc4962a15a6bed139217a6 |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

密码:123456

5.4 给nova用户添加admin角色

[root@node-251 openstack]# openstack role add --project service --user nova admin

5.5 创建 nova 服务实体

[root@node-251 openstack]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 23eda73ea54b4bc69865c005c4b872d6 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

5.6 创建 Compute 服务 API 端点

[root@node-251 openstack]# openstack endpoint create --region RegionOne compute public http://openstack.if010.com:8774/v2.1/%\(tenant_id\)s
+--------------+----------------------------------------------------+
| Field        | Value                                              |
+--------------+----------------------------------------------------+
| enabled      | True                                               |
| id           | 580a6875fd824241b9a4401a174d0166                   |
| interface    | public                                             |
| region       | RegionOne                                          |
| region_id    | RegionOne                                          |
| service_id   | 23eda73ea54b4bc69865c005c4b872d6                   |
| service_name | nova                                               |
| service_type | compute                                            |
| url          | http://openstack.if010.com:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------------+
[root@node-251 openstack]# openstack endpoint create --region RegionOne compute internal http://openstack.if010.com:8774/v2.1/%\(tenant_id\)s
+--------------+----------------------------------------------------+
| Field        | Value                                              |
+--------------+----------------------------------------------------+
| enabled      | True                                               |
| id           | 9f53befcead94d73b0bbd4b3d6c51db5                   |
| interface    | internal                                           |
| region       | RegionOne                                          |
| region_id    | RegionOne                                          |
| service_id   | 23eda73ea54b4bc69865c005c4b872d6                   |
| service_name | nova                                               |
| service_type | compute                                            |
| url          | http://openstack.if010.com:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------------+
[root@node-251 openstack]# openstack endpoint create --region RegionOne compute admin http://openstack.if010.com:8774/v2.1/%\(tenant_id\)s
+--------------+----------------------------------------------------+
| Field        | Value                                              |
+--------------+----------------------------------------------------+
| enabled      | True                                               |
| id           | 0f4c790dae824f06abf9e0748f7e0500                   |
| interface    | admin                                              |
| region       | RegionOne                                          |
| region_id    | RegionOne                                          |
| service_id   | 23eda73ea54b4bc69865c005c4b872d6                   |
| service_name | nova                                               |
| service_type | compute                                            |
| url          | http://openstack.if010.com:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------------+

5.7 创建placement并设置密码

[root@node-251 openstack]# openstack user create --domain default --password-prompt placement
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled             | True                             |
| id                  | ba0caba6ecdc4165a9b45c3cc72bca2d |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

密码:123456

5.8 给 placement 用户添加 admin 角色

[root@node-251 openstack]# openstack role add --project service --user placement admin

5.9 创建 placement 服务实体

[root@node-251 openstack]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 12b353be65ad4f919b2c80f60ed8f733 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

5.10 创建 placement 服务 API 端点

[root@node-251 openstack]# openstack endpoint create --region RegionOne placement public http://openstack.if010.com:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0213e591bb17446ea5854be7dd73b2d4 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 12b353be65ad4f919b2c80f60ed8f733 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack.if010.com:8778  |
+--------------+----------------------------------+
[root@node-251 openstack]# openstack endpoint create --region RegionOne placement internal http://openstack.if010.com:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 3323672681c14529ad3b30483f5ec2a0 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 12b353be65ad4f919b2c80f60ed8f733 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack.if010.com:8778  |
+--------------+----------------------------------+
[root@node-251 openstack]# openstack endpoint create --region RegionOne placement admin http://openstack.if010.com:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 01c0125e00df4964a2a042d8c11a2bde |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 12b353be65ad4f919b2c80f60ed8f733 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack.if010.com:8778  |
+--------------+----------------------------------+

5.11 Nova 控制节点安装与配置

安装

[root@node-251 openstack]# yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient openstack-nova-placement-api

配置/etc/nova/nova.conf文件

[root@node-251 openstack]# egrep -v '^#|^$' /etc/nova/nova.conf
[DEFAULT]
block_device_allocate_retries=60
my_ip=192.168.71.251
use_neutron=true
firewall_driver=nova.virt.firewall.NoopFirewallDriver
enabled_apis=osapi_compute,metadata
transport_url=rabbit://openstack:[email protected]
rpc_backend=rabbit
[api]
auth_strategy=keystone
[api_database]
connection=mysql+pymysql://nova:[email protected]/nova_api
[barbican]
[cache]
[cells]
[cinder]
os_region_name=RegionOne
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[crypto]
[database]
connection=mysql+pymysql://nova:[email protected]/nova
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers=http://openstack.if010.com:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
auth_uri=http://openstack.if010.com:5000
auth_url=http://openstack.if010.com:35357
memcached_servers=openstack.if010.com:11211
auth_type=password
project_domain_name=Default
user_domain_name=Default
project_name=service
username=nova
password=123456
[libvirt]
virt_type=qemu
[matchmaker_redis]
[metrics]
[mks]
[neutron]
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path=/var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
rabbit_host=192.168.71.251
rabbit_port=5672
rabbit_userid=openstack
rabbit_password=1735e32955b2ef18362e
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
os_region_name=RegionOne
auth_type=password
auth_url=http://openstack.if010.com:35357/v3
project_name=service
project_domain_name = Default
username=placement
user_domain_name=Default
password=123456
[quota]
[rdp]
[remote_debug]
[scheduler]
discover_hosts_in_cells_interval=360
[serial_console]
[service_user]
project_name=service
username=neutron
password=123456
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled=true
server_listen=$my_ip
server_proxyclient_address=$my_ip
[workarounds]
[wsgi]
[xenserver]
[xvp]

注意:libvirt项的配置确定您的计算节点是否支持虚拟机的硬件加速"
egrep -c ‘(vmx|svm)’ /proc/cpuinfo

  • 如果这个命令返回了 one or greater 的值,那么你的计算节点支持硬件加速且不需要额外的配置。
  • 如果这个命令返回了 zero 值,那么你的计算节点不支持硬件加速。你必须配置 libvirt 来使用 QEMU 去代替 KVM[/collapse]

配置00-nova-placement-api.conf文件

[root@openstack ~]# vim /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>

5.12 重启httpd服务

[root@openstack ~]# systemctl restart httpd.service

5.13 同步Nova数据库

[root@node-251 openstack]# su -s /bin/sh -c "nova-manage api_db sync" nova				#同步nova_api数据
[root@node-251 openstack]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova		# 注册cell0数据库
Cell0 is already setup
[root@node-251 openstack]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova	# 创建cell0的单元格
The specified transport_url and/or database_connection combination already exists for another cell with uuid b71cca7b-7bee-436c-9156-52ad2e839d9c.
[root@node-251 openstack]# su -s /bin/sh -c "nova-manage db sync" nova					#同步nova数据
  1. 同步nova_api数据的时候报错了
OperationalError: (pymysql.err.OperationalError) (1044, u"Access denied for user 'nova'@'%' to database 'nova_api'") (Background on this error at: http://sqlalche.me/e/e3q8)

解决:

mysql> Grant all privileges on nova_api.* to 'nova'@'%';
Query OK, 0 rows affected (0.10 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
  1. 同步nova数据也报错了
Error: (pymysql.err.OperationalError) (1044, u"Access denied for user 'nova'@'%' to database 'nova_cell0'") (Background on this error at: http://sqlalche.me/e/e3q8)

解决:

mysql> Grant all privileges on nova_cell0.* to 'nova'@'%';
Query OK, 0 rows affected (0.10 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

5.14 验证nova cell0和cell1是否正确注册

[root@node-251 openstack]# nova-manage cell_v2 list_cells
+-------+--------------------------------------+-----------------------------------+-----------------------------------------------------+
|  Name |                 UUID                 |           Transport URL           |                 Database Connection                 |
+-------+--------------------------------------+-----------------------------------+-----------------------------------------------------+
| cell0 | 00000000-0000-0000-0000-000000000000 |               none:/              | mysql+pymysql://nova:****@192.168.71.251/nova_cell0 |
| cell1 | 99cc18ad-0c93-43f9-83b7-ce714c01d2d6 | rabbit://openstack:****@127.0.0.1 |    mysql+pymysql://nova:****@192.168.71.251/nova    |
+-------+--------------------------------------+-----------------------------------+-----------------------------------------------------+

5.15 启动 Compute 服务并将其设置为随系统启动

[root@openstack ~]# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@openstack ~]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

nova.conf的内容有些提前配置了,如neutron服务、cinder服务等,可能会影响服务的启动

5.16 安装并配置计算节点

yum install openstack-nova-compute

配置/etc/nova/nova.conf文件

[root@node-252 ~]# egrep -v '^#|^$' /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url=rabbit://openstack:[email protected]
my_ip=192.168.71.251
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri=http://openstack.if010.com:5000
auth_url=http://openstack.if010.com:35357
memcached_servers=openstack.if010.com:11211
auth_type=password
project_domain_name=Default
user_domain_name=Default
project_name=service
username=nova
password=123456
[vnc]
enabled=True
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=$my_ip
novncproxy_base_url=http://openstack.if010.com:6080/vnc_auto.html
[glance]
api_servers=http://openstack.if010.com: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://openstack.if010.com:35357/v3
username=placement
password=123456
[libvirt]
virt_type=qemu

5.17 启动计算服务及其依赖,并将其配置为随系统自动启动

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

openstack-nova-compute无法启动(长时间卡住不动),笔者尝试如下几个方法,最终得以解决

  1. 重建rabbitmq的openstack用户
[root@controller rabbitmq]# rabbitmqctl list_users
Listing users
openstack	[]
guest	[administrator]
[root@controller rabbitmq]# rabbitmqctl -q  delete_user openstack
[root@controller rabbitmq]# rabbitmqctl list_users
Listing users
guest	[administrator]
[root@controller ~]# rabbitmqctl add_user openstack Com.123
[root@controller rabbitmq]# rabbitmqctl set_permissions -p / openstack '.*' '.*' '.*'
Setting permissions for user "openstack" in vhost "/" ...
[root@controller ~]# rabbitmqctl list_users
Listing users
openstack	[]
 
[root@controller rabbitmq]# systemctl restart rabbitmq-server.service   
  1. 删除配置文件/etc/nova/nova.conf中的汉字注释

另外在尝试过程中,也修改过其他参数,不过记不清了,大概卡了一上午的时间才解决。笔者主要思路是解决计算节点无法和控制节点的rabbitmq通信。另外把配置文件中的neutron和其他不用的参数注释了。

5.18 验证操作

1. 发现计算主机操作

[root@node-251 openstack]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

当您添加新的计算节点时,您必须在控制器节点上运行以注册这些新的计算节点。或者可以编辑/etc/nova/nova.conf在以下位置设置适当的间隔

[scheduler]
...
discover_hosts_in_cells_interval=300

2. 确认数据库中是否有计算主机

[root@node-251 openstack]# openstack compute service list --service nova-compute
+----+--------------+----------+------+---------+-------+----------------------------+
| ID | Binary       | Host     | Zone | Status  | State | Updated At                 |
+----+--------------+----------+------+---------+-------+----------------------------+
|  9 | nova-compute | node-252 | nova | enabled | up    | 2023-06-07T05:21:01.000000 |
+----+--------------+----------+------+---------+-------+----------------------------+

3. 列出服务组件以验证每个进程的成功启动和注册

[root@node-251 openstack]# openstack compute service list
+----+------------------+----------+----------+---------+-------+----------------------------+
| ID | Binary           | Host     | Zone     | Status  | State | Updated At                 |
+----+------------------+----------+----------+---------+-------+----------------------------+
|  1 | nova-consoleauth | node-251 | internal | enabled | up    | 2023-06-07T05:21:37.000000 |
|  2 | nova-scheduler   | node-251 | internal | enabled | up    | 2023-06-07T05:21:37.000000 |
|  3 | nova-conductor   | node-251 | internal | enabled | up    | 2023-06-07T05:21:37.000000 |
|  9 | nova-compute     | node-252 | nova     | enabled | up    | 2023-06-07T05:21:31.000000 |
+----+------------------+----------+----------+---------+-------+----------------------------+

4. 列出身份服务中的API端点以验证与身份服务的连接

[root@node-251 openstack]# openstack catalog list
+-----------+-----------+-----------------------------------------------------------------------------------+
| Name      | Type      | Endpoints                                                                         |
+-----------+-----------+-----------------------------------------------------------------------------------+
| placement | placement | RegionOne                                                                         |
|           |           |   admin: http://openstack.if010.com:8778                                          |
|           |           | RegionOne                                                                         |
|           |           |   public: http://openstack.if010.com:8778                                         |
|           |           | RegionOne                                                                         |
|           |           |   internal: http://openstack.if010.com:8778                                       |
|           |           |                                                                                   |
| nova      | compute   | RegionOne                                                                         |
|           |           |   admin: http://openstack.if010.com:8774/v2.1/2aaf4155b00749b0a333a039c17c131c    |
|           |           | RegionOne                                                                         |
|           |           |   public: http://openstack.if010.com:8774/v2.1/2aaf4155b00749b0a333a039c17c131c   |
|           |           | RegionOne                                                                         |
|           |           |   internal: http://openstack.if010.com:8774/v2.1/2aaf4155b00749b0a333a039c17c131c |
|           |           |                                                                                   |
| keystone  | identity  | RegionOne                                                                         |
|           |           |   internal: http://openstack.if010.com:5000/v3                                    |
|           |           | RegionOne                                                                         |
|           |           |   public: http://openstack.if010.com:5000/v3                                      |
|           |           | RegionOne                                                                         |
|           |           |   admin: http://openstack.if010.com:35357/v3                                      |
|           |           |                                                                                   |
| glance    | image     | RegionOne                                                                         |
|           |           |   public: http://openstack.if010.com:9292                                         |
|           |           | RegionOne                                                                         |
|           |           |   admin: http://openstack.if010.com:9292                                          |
|           |           | RegionOne                                                                         |
|           |           |   internal: http://openstack.if010.com:9292                                       |
|           |           |                                                                                   |
+-----------+-----------+-----------------------------------------------------------------------------------+

5. 列出Image服务中的图像以验证与Image服务的连接性

[root@node-251 openstack]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 45d98b6f-3f42-48dc-a0b3-cab7a27fb8d5 | cirros | active |
+--------------------------------------+--------+--------+

6. 检查cells和placement API是否成功运行

[root@node-251 openstack]# nova-status upgrade check
Option "os_region_name" from group "placement" is deprecated. Use option "region-name" from group "placement".
+--------------------------------+
| Upgrade Check Results          |
+--------------------------------+
| Check: Cells v2                |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Placement API           |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Resource Providers      |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: API Service Version     |
| Result: Success                |
| Details: None                  |
+--------------------------------+

你可能感兴趣的:(#,openstack,openstack)