那些年踩过的坑之Ubuntu openstack搭建

在搭建Ubuntu上的OpenStack过程中遇到了多个挑战,包括Horizon访问错误500和504,Apache2配置问题,Nova管理和计算节点错误,以及Keystone、Placement和Neutron服务的故障。通过修改配置文件,如openstack-dashboard.conf和keystone.conf,重启服务,以及解决数据库和transport_url问题,逐步解决了这些问题。此外,针对Nova-compute的FileNotFoundError,调整了instances_path配置并重启服务。在遇到服务列表为空或升级检查失败时,删除并重建了cell,解决了内部服务器错误。最后,针对创建VM时的权限问题,检查并调整了Neutron的日志配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

搭建文档参考官网教程:
https://docs.openstack.org/install-guide/

  • 访问controller/horizon出错500:internal server error; 访问controller/horizon出错504:internal server error  gateway timeout

        WSGIApplicationGroup %{GLOBAL}

        把上面这行添加到/etc/apache2/conf-available/openstack-dashboard.conf

  • 搭建apache2过程遇到35357没起来,更新/etc/apache2/sites-available/keystone.conf,添加35357配置部分

  1.         vim /etc/apache2/sites-available/keystone.conf
Listen 5000
Listen 35357
<VirtualHost *:5000>
    WSGIScriptAlias / /usr/bin/keystone-wsgi-public
    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    LimitRequestBody 114688

    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>

    ErrorLog /var/log/apache2/keystone.log
    CustomLog /var/log/apache2/keystone_access.log combined

    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>
</VirtualHost>

<VirtualHost *:35357>
    WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    LimitRequestBody 114688

    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>

    ErrorLog /var/log/apache2/keystone.log
    CustomLog /var/log/apache2/keystone_access.log combined

    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>
</VirtualHost>

Alias /identity /usr/bin/keystone-wsgi-public
<Location /identity>
    SetHandler wsgi-script
    Options +ExecCGI

    WSGIProcessGroup keystone-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
</Location>


Alias /identity-admin /usr/bin/keystone-wsgi-admin
<Location /identity-admin>
    SetHandler wsgi-script
    Options +ExecCGI

    WSGIProcessGroup keystone-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
</Location>
  1.         重启服务

        service apache2 restart

  •  跑过一遍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

         方案1:带上对应更改的参数重跑

root@master01:/var/lib/glance/images# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose --transport-url rabbit://openstack:casa@master01:5672/ --database_connection mysql+pymysql://nova:casa@master01/nova_api" nova

a4b73290-01bb-4c48-b39d-8fff66cf264e

        方案2:删除错误的cells,重新添加

root@master01:/var/lib/glance/images# nova-manage cell_v2 list_cells
+-------+--------------------------------------+----------------------------------------+-----------------------------------------------+----------+
|  Name |                 UUID                 |             Transport URL              |              Database Connection              | Disabled |
+-------+--------------------------------------+----------------------------------------+-----------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |                 none:/                 | mysql+pymysql://nova:****@master01/nova_cell0 |  False   |
| cell1 | 28a769cd-5ae1-4e96-b948-320c671f6fa3 |  rabbit://openstack:****@master:5672/  |    mysql+pymysql://nova:****@master01/nova    |  False   |

root@master01:/var/lib/glance/images# nova-manage cell_v2 delete_cell --cell_uuid 28a769cd-5ae1-4e96-b948-320c671f6fa3
  • 计算节点nova-compute报错

    ERROR nova.compute.manager [req-d31bb39b-74c5-4228-970e-b19625cfab85 - - - - -] Error updating resources for node node01.: FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3/dist-packages/instances'

        添加参数 instances_path=/var/lib/nova/instances 到以下配置文件

root@node01:/etc/nova# vim /etc/nova/nova.conf
[DEFAULT]
transport_url = rabbit://openstack:casa@master01:5672/
my_ip = 172.0.16.19
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
instances_path=/var/lib/nova/instances

        重启nova服务

service nova-api restart
service nova-consoleauth restart
service nova-scheduler restart
service nova-conductor restart
service nova-novncproxy restart
  • 当配置完计算节点后,在控制节点执行openstack compute service list返回空

    查看计算节点日志

    root@node01:/etc/nova# tail -f /var/log/nova/nova-compute.log -n 500
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager [req-f0f54490-8d3a-4680-9e55-70085f75468e - - - - -] Error updating resources for node node01.: nova.exception.ResourceProviderRetrievalFailed: Failed to get resource provider with UUID 47bd6a9e-6c0c-477e-b555-b449c7314ca6
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager Traceback (most recent call last):
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/nova/compute/manager.py", line 9924, in _update_available_resource_for_node
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     self.rt.update_available_resource(context, nodename,
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/nova/compute/resource_tracker.py", line 896, in update_available_resource
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     self._update_available_resource(context, resources, startup=startup)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/oslo_concurrency/lockutils.py", line 360, in inner
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     return f(*args, **kwargs)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/nova/compute/resource_tracker.py", line 981, in _update_available_resource
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     self._update(context, cn, startup=startup)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/nova/compute/resource_tracker.py", line 1233, in _update
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     self._update_to_placement(context, compute_node, startup)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/retrying.py", line 49, in wrapped_f
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     return Retrying(*dargs, **dkw).call(f, *args, **kw)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dist-packages/retrying.py", line 206, in call
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager     return attempt.get(self._wrap_exception)
    2022-05-07 08:11:56.580 325486 ERROR nova.compute.manager   File "/usr/lib/python3/dis
### Ubuntu OpenStack Cloud Platform Setup Steps Tutorial #### Prerequisites For deploying an OpenStack environment on Ubuntu, ensure the system meets minimum hardware requirements and has a fresh installation of Ubuntu Server. Network configuration should be planned ahead to support multiple networks required by OpenStack services[^1]. #### Installation Method Selection Choose between different deployment methods such as using conjure-up which simplifies the process with Canonical Distribution of Kubernetes or opting for manual setup through command line tools like `openstack` client and `apt-get`. Each method caters to varying levels of customization needs. #### Environment Preparation Install necessary packages including Python virtual environments and development libraries that are prerequisites for running OpenStack components effectively. Update package lists before proceeding further. ```bash sudo apt update && sudo apt upgrade -y ``` #### Deploying Base Components Start by setting up Keystone (Identity Service), which manages users and their access permissions within the cloud infrastructure. Followed by Glance (Image service) responsible for storing VM images used across instances. ```bash # Install keystone sudo apt install keystone -y # Configure database backend... ``` #### Networking Configuration Neutron facilitates network connectivity among various resources inside OpenStack clouds. Define external bridges alongside internal ones ensuring proper communication channels exist between nodes. ```bash # Example neutron plugin ML2 configuration snippet vi /etc/neutron/plugins/ml2/ml2_conf.ini ``` #### Compute Node Integration Nova handles computing tasks; integrate compute nodes into the cluster after configuring controller node settings properly. Verify nova-compute service status post-installation. ```bash service nova-compute restart systemctl enable nova-compute ``` #### Dashboard Access Horizon provides web-based graphical interface allowing administrators & end-users alike easy management over deployed workloads without needing direct shell access all times. ```bash # Enable horizon dashboard sudo apt install openstack-dashboard apache2 libapache2-mod-wsgi-py3 -y ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小吴在此

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值