描述

描述

描述

我使用以下方式安装了 Openstack WallabyOpenStack安装指南,所有命令和配置都在我的Github。这个 LAB 在 VirtualBox 上运行,并且我在 ESXi 上有另一个具有相同配置和 Openstack 版本的 LAB,没有任何问题。

在此刻一个控制器两个计算节点。

在下面的部分中正确改进数据库权限配置

数据库已正确创建:

user@controller001:~$ sudo mysql
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| placement          |
+--------------------+

授予这些数据库的所有权限:

MariaDB [(none)]> SHOW GRANTS FOR nova;
+-----------------------------------------------------------------------------------------------------+
| Grants for nova@%                                                                                   |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `nova`@`%` IDENTIFIED BY PASSWORD '*3A4A03AC22526F6B591010973A741D59A71D728E' |
| GRANT ALL PRIVILEGES ON `nova`.* TO `nova`@`%`                                                      |
| GRANT ALL PRIVILEGES ON `nova_cell0`.* TO `nova`@`%`                                                |
| GRANT ALL PRIVILEGES ON `nova_api`.* TO `nova`@`%`                                                  |
+-----------------------------------------------------------------------------------------------------+

从计算节点远程访问数据库:

user@compute001:~$ mysql -unova -popenstack -h controller001

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| nova               |
| nova_api           |
| nova_cell0         |
+--------------------+

重启nova服务后的Mysql日志:

user@controller001:~$ sudo systemctl restart nova-*

user@controller001:~$ sudo tail -f /var/log/mysql/error.log
2021-10-02 12:52:12 112 [Warning] Aborted connection 112 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 118 [Warning] Aborted connection 118 to db: 'nova_api' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 116 [Warning] Aborted connection 116 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 119 [Warning] Aborted connection 119 to db: 'nova_api' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 115 [Warning] Aborted connection 115 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 113 [Warning] Aborted connection 113 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 114 [Warning] Aborted connection 114 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 117 [Warning] Aborted connection 117 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 109 [Warning] Aborted connection 109 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 110 [Warning] Aborted connection 110 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 111 [Warning] Aborted connection 111 to db: 'nova' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 108 [Warning] Aborted connection 108 to db: 'nova_cell0' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 103 [Warning] Aborted connection 103 to db: 'nova_api' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 102 [Warning] Aborted connection 102 to db: 'nova_api' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:12 105 [Warning] Aborted connection 105 to db: 'nova_cell0' user: 'nova' host: 'controller001' (Got an error reading communication packets)
2021-10-02 12:52:16 141 [Warning] Access denied for user 'nova'@'controller001' (using password: YES)
2021-10-02 12:52:16 142 [Warning] Access denied for user 'nova'@'controller001' (using password: YES)
2021-10-02 12:52:17 147 [Warning] Access denied for user 'nova'@'controller001' (using password: YES)

读取通信数据包时出错

这里以下是解决此错误的一些建议:

SET GLOBAL max_allowed_packet = 1024 * 1024 * 256; 
set @@global.max_connections = 400;
SET GLOBAL interactive_timeout=6000;
SET GLOBAL innodb_buffer_pool_size = 1024 * 1024 * 2;

任何尝试发现新主机都会出现以下错误:

user@controller001:~$ sudo su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
....
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'nova'@'controller001' (using password: YES)")
(Background on this error at: http://sqlalche.me/e/13/e3q8)

但我不确定这是否是一个错误

user@controller001:~$ os hypervisor list
Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'sqlalchemy.exc.OperationalError'> (HTTP 500) (Request-ID: req-d6edcfa3-ccf2-4eb8-80f8-041cb55e772d)

名称配置:

user@controller001:~$ . admin-openrc 
user@controller001:~$ os endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                            |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
| 1e2f0fc829f84a53a337bbb70e7679af | RegionOne | nova         | compute      | True    | internal  | http://controller001:8774/v2.1 |
| 38e967a4c87f4464ba6ac965c889f6a4 | RegionOne | placement    | placement    | True    | admin     | http://controller001:8778      |
| 398d51ab439f4afc8fb7c71adc1bf3a9 | RegionOne | keystone     | identity     | True    | internal  | http://controller001:5000/v3/  |
| 4aaf9ac0ccec41978e541a0de0e55ed4 | RegionOne | nova         | compute      | True    | public    | http://controller001:8774/v2.1 |
| 52ba2047ed864b9aa6ad352ba2fe59dc | RegionOne | nova         | compute      | True    | admin     | http://controller001:8774/v2.1 |
| 659ed7ae84074b30a6a4941648b994c3 | RegionOne | placement    | placement    | True    | internal  | http://controller001:8778      |
| 9cd126c1f07e4b13946edcdc80f9f215 | RegionOne | placement    | placement    | True    | public    | http://controller001:8778      |
| aec5b18b834b4a9cad8a4efb83b1b1d7 | RegionOne | glance       | image        | True    | internal  | http://controller001:9292      |
| b1a13f51438c40b8b74ec25b89efebab | RegionOne | glance       | image        | True    | public    | http://controller001:9292      |
| c35c703090f3478aa7d960293fde1bf0 | RegionOne | keystone     | identity     | True    | admin     | http://controller001:5000/v3/  |
| ca231e48c3ad406c8ec757c765b651a6 | RegionOne | glance       | image        | True    | admin     | http://controller001:9292      |
| ff927678f6634475bd80bdba7effc3fc | RegionOne | keystone     | identity     | True    | public    | http://controller001:5000/v3/  |
+----------------------------------+-----------+--------------+--------------+---------+-----------+--------------------------------+
user@controller001:~$ sudo 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:****@controller001/nova_cell0 |  False   |
| cell1 | e62ffdc8-5f28-43ef-9bcb-404812faaeae | rabbit://openstack:****@controller001:5672/ |    mysql+pymysql://nova:****@controller001/nova    |  False   |
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
user@controller001:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 controller001

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

172.16.50.41    controller001
172.16.50.42    compute011

答案1

这与 MariaDB 权限或数据库 URL 无关。

用这个解决问题错误描述还有其他解决方案对我来说不起作用。创建完全一样的单元格nova 安装指南为我工作并添加传输网址数据库连接新曼日命令是我的错,尽管它过去对我有用。

“如果您未指定 --database_connection,那么 nova-manage 将使用配置文件中的 [database]/connection 值,并将数据库名称修改为带有 _cell0 后缀。”

和:

“如果您的数据库位于不同的主机上,那么您应该指定 --database_connection 或确保所使用的 nova.conf 具有指向适用于 cell0 数据库的相同用户/密码/主机的 [database]/connection 值。如果 cell0 映射创建不正确,可以使用 nova-manage cell_v2 delete_cell 命令将其删除,然后使用正确的数据库连接值再次运行 map_cell0。”

所以我认为可能发生的情况是,当您运行 map_cell0 时,它会使用错误的数据库连接 URL 创建 nova_api.cell_mappings 记录,因为现在依赖 cell_mappings 表记录连接到 cell0 数据库的 db sync 失败了,因为它正在寻找 nova_api_cell0,但您有 nova_cell0。

如果在运行 map_cell0 时未指定 --database-connection,则以下代码将创建默认 cell0 连接 URL:

所以我认为您可能只想(1)删除 cell0 映射(2)再次运行 map_cell0 并确保它使用正确的数据库连接 URL 创建 cell0 条目,然后(3)再次运行 nova-manage db sync。

sudo su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
sudo su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --transport-url rabbit://openstack:****@controller001:5672/ --database_connection mysql+pymysql://nova:****@controller001/nova  --verbose" nova 


user@controller001:~$ sudo 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:****@controller001/nova_cell0 |  False   |
| cell1 | 553970ef-335a-4cf1-90fb-8268c49d5fad | rabbit://openstack:****@controller001:5672/ |    mysql+pymysql://nova:****@controller001/nova    |  False   |
+-------+--------------------------------------+-------------------------------------------+--------------------------------------------------+----------+

user@controller001:~$ sudo su -s /bin/sh -c "nova-manage cell_v2 delete_cell --cell_uuid  00000000-0000-0000-0000-000000000000" nova
user@controller001:~$ sudo su -s /bin/sh -c "nova-manage cell_v2 delete_cell --cell_uuid  553970ef-335a-4cf1-90fb-8268c49d5fad" nova



user@controller001:~$ sudo su -s /bin/sh -c "nova-manage api_db sync" nova
user@controller001:~$ sudo su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
user@controller001:~$ sudo  su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
--transport-url not provided in the command line, using the value [DEFAULT]/transport_url from the configuration file
--database_connection not provided in the command line, using the value [database]/connection from the configuration file
d448f914-53fa-410c-8f89-407e33c96c3f
user@controller001:~$ sudo su -s /bin/sh -c "nova-manage db sync" nova
user@controller001:~$ sudo 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:****@controller001/nova_cell0 |  False   |
| cell1 | d448f914-53fa-410c-8f89-407e33c96c3f | rabbit://openstack:****@controller001:5672/ |    mysql+pymysql://nova:****@controller001/nova    |  False   |
+-------+--------------------------------------+-------------------------------------------+--------------------------------------------------+----------+

user@controller001:~$ openstack compute service list --service nova-compute
+----+--------------+-----------+------+---------+-------+----------------------------+
| ID | Binary       | Host      | Zone | Status  | State | Updated At                 |
+----+--------------+-----------+------+---------+-------+----------------------------+
|  5 | nova-compute | compute21 | nova | enabled | up    | 2021-10-09T13:59:32.000000 |
+----+--------------+-----------+------+---------+-------+----------------------------+

相关内容