本文共 14644 字,大约阅读时间需要 48 分钟。
计算服务需要在控制节点和计算节点一起配置
创建nova_api, nova, nova_cell0数据库
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 'nova';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ -> IDENTIFIED BY 'nova';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \ -> IDENTIFIED BY 'nova';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova';
创建nova用户
[root@controller ~]# . admin-openrc[root@controller ~]# openstack user create --domain default --password-prompt novaUser Password:Repeat User Password:+---------------------+----------------------------------+| Field | Value |+---------------------+----------------------------------+| domain_id | default || enabled | True || id | af480073f49a4fef9275f8aa7f457fbf || name | nova || options | { } || password_expires_at | None |+---------------------+----------------------------------+
给 nova 用户添加 admin 角色:
[root@controller ~]# openstack role add --project service --user nova admin
创建 nova 服务实体:
[root@controller ~]# openstack service create --name nova \> --description "OpenStack Compute" compute+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | OpenStack Compute || enabled | True || id | e21ec3a543414595b338feff73856683 || name | nova || type | compute |+-------------+----------------------------------+
创建 Compute 服务 API 端点 :
[root@controller ~]# openstack endpoint create --region RegionOne \> compute public http://controller:8774/v2.1+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | b46e7b8a2cfe49d195cd0e71d6ef6380 || interface | public || region | RegionOne || region_id | RegionOne || service_id | e21ec3a543414595b338feff73856683 || service_name | nova || service_type | compute || url | http://controller:8774/v2.1 |+--------------+----------------------------------+[root@controller ~]# openstack endpoint create --region RegionOne \> compute internal http://controller:8774/v2.1+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 00e14d65f0564aa283f6916da9d89c2a || interface | internal || region | RegionOne || region_id | RegionOne || service_id | e21ec3a543414595b338feff73856683 || service_name | nova || service_type | compute || url | http://controller:8774/v2.1 |+--------------+----------------------------------+[root@controller ~]# openstack endpoint create --region RegionOne \> compute admin http://controller:8774/v2.1+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 064e81aea1e34a48b4ef0f2acbd00dd3 || interface | admin || region | RegionOne || region_id | RegionOne || service_id | e21ec3a543414595b338feff73856683 || service_name | nova || service_type | compute || url | http://controller:8774/v2.1 |+--------------+----------------------------------+
创建一个placement服务用户
[root@controller ~]# openstack user create --domain default --password placement placement+---------------------+----------------------------------+| Field | Value |+---------------------+----------------------------------+| domain_id | default || enabled | True || id | 684a91a0187842a5bc63635df21fd227 || name | placement || options | { } || password_expires_at | None |+---------------------+----------------------------------+
添加placement用户为项目服务admin角色
[root@controller ~]# openstack role add --project service --user placement admin
创建在服务目录创建Placement API服务
[root@controller ~]# openstack service create --name placement --description "Placement API" placement+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | Placement API || enabled | True || id | 67a025f2a5b841f7baf811f197929a3b || name | placement || type | placement |+-------------+----------------------------------+
创建Placement API服务端点
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8780+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | a74fb88f9a1c4b86a5d1980661fff406 || interface | public || region | RegionOne || region_id | RegionOne || service_id | 67a025f2a5b841f7baf811f197929a3b || service_name | placement || service_type | placement || url | http://controller:8780 |+--------------+----------------------------------+[root@controller ~]# openstack endpoint create --region RegionOne placement internal http://controller:8780+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 52c44dc2d3fc42d8815e22f3e8d06c89 || interface | internal || region | RegionOne || region_id | RegionOne || service_id | 67a025f2a5b841f7baf811f197929a3b || service_name | placement || service_type | placement || url | http://controller:8780 |+--------------+----------------------------------+[root@controller ~]# openstack endpoint create --region RegionOne placement admin http://controller:8780+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 9ec16a5764d7468687bd0ec5e0445f1f || interface | admin || region | RegionOne || region_id | RegionOne || service_id | 67a025f2a5b841f7baf811f197929a3b || service_name | placement || service_type | placement || url | http://controller:8780 |+--------------+----------------------------------+
安装软件包
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
编辑nova主配置文件
[root@controller ~]# vim /etc/nova/nova.conf[DEFAULT]enabled_apis = osapi_compute,metadatatransport_url = rabbit://openstack:openstack@controllermy_ip = 192.168.223.11use_neutron = Truefirewall_driver = nova.virt.firewall.NoopFirewallDriver[api_database] connection = mysql+pymysql://nova:nova@controller/nova_api[database] connection = mysql+pymysql://nova:nova@controller/nova[api]auth_strategy = keystone[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = nova[vnc]enabled = trueserver_listen = $my_ipserver_proxyclient_address = $my_ip[glance]api_servers = http://controller:9292[oslo_concurrency]lock_path = /var/lib/nova/tmp[placement]os_region_name = RegionOneproject_domain_name = Defaultproject_name = serviceauth_type = passworduser_domain_name = Defaultauth_url = http://controller:35357/v3username = placementpassword = placement
由于软件包的一个bug,需要在/etc/httpd/conf.d/00-nova-placement-api.conf文件中添加如下配置
[root@controller ~]# vim /etc/httpd/conf.d/00-nova-placement-api.conf[root@controller ~]# systemctl restart httpd ##重启服务 = 2.4> Require all granted < 2.4> Order allow,deny Allow from all
同步数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
注册cell0数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
创建cell1 cell
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
同步nova数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
验证 nova、 cell0、 cell1数据库是否注册正确
[root@controller ~]# nova-manage cell_v2 list_cells+-------+--------------------------------------+------------------------------------+-------------------------------------------------+| 名称 | UUID | Transport URL | 数据库连接 |+-------+--------------------------------------+------------------------------------+-------------------------------------------------+| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller/nova_cell0 || cell1 | ac6fcd37-7a3e-44ad-a823-5fa5289ac826 | rabbit://openstack:****@controller | mysql+pymysql://nova:****@controller/nova |+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
设置开机自启和启动
[root@controller ~]# systemctl enable openstack-nova-api.service \> openstack-nova-consoleauth.service openstack-nova-scheduler.service \> openstack-nova-conductor.service openstack-nova-novncproxy.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.[root@controller ~]# systemctl start openstack-nova-api.service \> openstack-nova-consoleauth.service openstack-nova-scheduler.service \> openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@compute1 ~]# yum install openstack-nova-compute -y
安装完成配置文件
[root@compute1 ~]# vim /etc/nova/nova.conf[DEFAULT] [root@compute1 ~]# vim /etc/nova/nova.conf enabled_apis = osapi_compute,metadatatransport_url = rabbit://openstack:openstack@controllermy_ip = 192.168.223.12use_neutron = Truefirewall_driver = nova.virt.firewall.NoopFirewallDriver[api]auth_strategy = keystone[keystone_authtoken]auth_uri = http://controller:5000auth_url = http://controller:35357memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = nova[vnc]enabled = Trueserver_listen = 0.0.0.0server_proxyclient_address = $my_ipnovncproxy_base_url = http://controller:6080/vnc_auto.html[glance]api_servers = http://controller:9292[oslo_concurrency]lock_path = /var/lib/nova/tmp[placement]os_region_name = RegionOneproject_domain_name = Defaultproject_name = serviceauth_type = passworduser_domain_name = Defaultauth_url = http://controller:35357/v3username = placementpassword = placement
配置完成还应该查看机器是否支持硬件加速
[root@compute1 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo2 ##这个值大于1[root@compute1 ~]# lsmod | grep kvm ##可以过滤出信息说明可以kvm_intel 188688 0 kvm 636921 1 kvm_intelirqbypass 13503 1 kvm
下来就可以开启服务
[root@compute1 ~]# systemctl enable libvirtd.service openstack-nova-compute.service[root@compute1 ~]# systemctl start libvirtd.service openstack-nova-compute.service
将计算节点加入后可以在控制节点列出查看
[root@controller ~]# openstack compute service list+----+------------------+------------+----------+---------+-------+----------------------------+| ID | Binary | Host | Zone | Status | State | Updated At |+----+------------------+------------+----------+---------+-------+----------------------------+| 1 | nova-consoleauth | controller | internal | enabled | up | 2020-04-06T09:12:14.000000 || 2 | nova-conductor | controller | internal | enabled | up | 2020-04-06T09:12:12.000000 || 3 | nova-scheduler | controller | internal | enabled | up | 2020-04-06T09:12:13.000000 || 6 | nova-compute | compute1 | nova | enabled | up | 2020-04-06T09:12:12.000000 |+----+------------------+------------+----------+---------+-------+----------------------------+ ##服务都up说明没问题
转载地址:http://kfjwn.baihongyu.com/