openstack-rocky安装部署-04安装nova
先决条件
创建数据库并授权
mysql -u root -p123 CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE nova_cell0; CREATE DATABASE placement; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \ IDENTIFIED BY '123'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \ IDENTIFIED BY '123';
创建用户及角色添加
#创建nova用户:
openstack user create --domain default --password-prompt nova
123
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 86a9ad96763a433d97e3e11006996b35 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
#将admin角色添加到nova用户:
openstack role add --project service --user nova admin
#r版本中增加了placement项目:
#创建placement用户
openstack user create --domain default --password=placement placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 4eac351f5143478abaea967153614f5f |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
#角色添加
openstack role add --project service --user placement admin
#创建nova服务实体: openstack service create --name nova \ --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 5b1a8101b38245df8541f9644fd2b145 | | name | nova | | type | compute | +-------------+----------------------------------+ #创建Compute API服务端点: openstack endpoint create --region RegionOne \ compute public http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 6ae5782a7aba4877b8673be5e3905b31 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 5b1a8101b38245df8541f9644fd2b145 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ openstack endpoint create --region RegionOne \ compute internal http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 3ef9cad9f3524ce3a29407638d31dce1 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 5b1a8101b38245df8541f9644fd2b145 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ openstack endpoint create --region RegionOne \ compute admin http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 0d5c5ae54eef4ffebd20ab9dc7347a79 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 5b1a8101b38245df8541f9644fd2b145 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+
openstack service create --name placement --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Placement API | | enabled | True | | id | 2374118be78746a5963f75cd1b0f5111 | | name | placement | | type | placement | +-------------+----------------------------------+ openstack endpoint create --region RegionOne placement public http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | b17c938e2d5b405389437c2d3109f3dc | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 2374118be78746a5963f75cd1b0f5111 | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ openstack endpoint create --region RegionOne placement internal http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | b8fd181b56e146318a5099259ededd81 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 2374118be78746a5963f75cd1b0f5111 | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ openstack endpoint create --region RegionOne placement admin http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | df4e556ca8ff480fa08dfbe77daf24ef | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 2374118be78746a5963f75cd1b0f5111 | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+
安装
yum install openstack-nova-api openstack-nova-conductor \ openstack-nova-novncproxy openstack-nova-scheduler \ openstack-nova-placement-api openstack-nova-console -y
配置
vi /etc/nova/nova.conf
[DEFAULT] # ... enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:123@controller # ...控制节点管理网ip my_ip = 10.0.0.11 use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] # ... connection = mysql+pymysql://nova:123@controller/nova_api [database] # ... connection = mysql+pymysql://nova:123@controller/nova [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_url = http://controller:5000/v3 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = 123 #nova中neutron部分 [vnc] enabled = true # ... server_listen = $my_ip server_proxyclient_address = $my_ip [glance] # ... api_servers = http://controller:9292 [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp [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 = placement [placement_database] connection = mysql+pymysql://placement:123@controller/placement [scheduler] discover_hosts_in_cells_interval = 300 # 服务端的计算节点多久去检查一次新加入的host主机信息,可以自动将安装好的计算节点主机加入集群
由于打包错误,您必须通过将以下配置添加到以下内容来启用对Placement API的访问
vi /etc/httpd/conf.d/00-nova-placement-api.conf
Listen 8778
<VirtualHost *:8778>
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
WSGIScriptAlias / /usr/bin/nova-placement-api
<IfVersion >= 2.4>
ErrorLogFormat "%M"
</IfVersion>
ErrorLog /var/log/nova/nova-placement-api.log
#SSLEngine On
#SSLCertificateFile ...
#SSLCertificateKeyFile ...
</VirtualHost>
Alias /nova-placement-api /usr/bin/nova-placement-api
<Location /nova-placement-api>
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
</Location>
# made by zhaoshuai
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
systemctl restart httpd systemctl status httpd
填充nova-api和placement数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
#注册cell0数据库 su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova #创建cell1单元格 su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova ebf18e1d-e78a-4009-bd74-44d714fc4b05 su -s /bin/sh -c "nova-manage db sync" nova /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.') result = self._query(query) /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.') result = self._query(query) #验证cell0和cell1是否正确注册 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 | ebf18e1d-e78a-4009-bd74-44d714fc4b05 | rabbit://openstack:****@controller | mysql+pymysql://nova:****@controller/nova | False | +-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+
完成安装
systemctl enable openstack-nova-api.service \ openstack-nova-consoleauth openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl start openstack-nova-api.service \ openstack-nova-consoleauth openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl list-unit-files |grep openstack-nova* |grep enabled
查服务列表
openstack service list +----------------------------------+-----------+-----------+ | ID | Name | Type | +----------------------------------+-----------+-----------+ | 2374118be78746a5963f75cd1b0f5111 | placement | placement | | 333767869ae94b81ac91b9b983f7766f | glance | image | | 53551b2b6f0a4b3cac50193233f237a6 | keystone | identity | | 5b1a8101b38245df8541f9644fd2b145 | nova | compute | +----------------------------------+-----------+-----------+ openstack compute service list +----+----------------+-------+----------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+----------------+-------+----------+---------+-------+----------------------------+ | 1 | nova-conductor | ceph1 | internal | enabled | up | 2019-04-03T09:27:21.000000 | | 2 | nova-scheduler | ceph1 | internal | enabled | up | 2019-04-03T09:27:16.000000 | +----+----------------+-------+----------+---------+-------+----------------------------+
安装配置计算节点
安装
yum install openstack-nova-compute python-openstackclient openstack-utils -y
配置
vi /etc/nova/nova.conf
[DEFAULT] # ... enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:123@controller # ...MANAGEMENT_INTERFACE_IP_ADDRESS为计算节点上管理网络接口的IP地址 my_ip = 10.1.1.12 use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver log_date_format=%Y-%m-%d %H:%M:%S log_file=nova-compute.log log_dir=/var/log/nova [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_url = http://controller:5000/v3 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = 123 #neutron部分 [vnc] # ... enabled = true server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080/vnc_auto.html [glance] # ... api_servers = http://controller:9292 [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp [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 = placement
完成安装
确定计算节点是否支持虚拟机的硬件加速
#计算节点是否支持虚拟机的硬件加速,返回0表示不支持硬件加速,需要用qemu egrep -c '(vmx|svm)' /proc/cpuinfo
vi /etc/nova/nova.conf
[libvirt] # ... virt_type = qemu
启动
systemctl enable libvirtd.service openstack-nova-compute.service systemctl start libvirtd.service openstack-nova-compute.service
去控制节点验证
#验证计算节点添加到单元数据库 openstack compute service list --service nova-compute +----+--------------+-------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+-------+------+---------+-------+----------------------------+ | 5 | nova-compute | ceph2 | nova | enabled | up | 2019-04-08T03:25:53.000000 | +----+--------------+-------+------+---------+-------+----------------------------+ #发现计算主机 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': ebf18e1d-e78a-4009-bd74-44d714fc4b05 Found 0 unmapped computes in cell: ebf18e1d-e78a-4009-bd74-44d714fc4b05 #在控制节点运行该命令发现主机,注册新入的compute node nova-manage cell_v2 discover_hosts vi /etc/nova/nova.conf #设置新创建节点自动注册的任务 [scheduler] discover_hosts_in_cells_interval = 300 #后续确认consoleauth是否在r版本中取消 openstack compute service list +----+------------------+-------+----------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+------------------+-------+----------+---------+-------+----------------------------+ | 1 | nova-conductor | ceph1 | internal | enabled | up | 2019-04-08T04:24:45.000000 | | 2 | nova-scheduler | ceph1 | internal | enabled | up | 2019-04-08T04:24:46.000000 | | 5 | nova-compute | ceph2 | nova | enabled | up | 2019-04-08T04:24:45.000000 | | 6 | nova-consoleauth | ceph1 | internal | enabled | up | 2019-04-08T04:24:45.000000 | +----+------------------+-------+----------+---------+-------+----------------------------+ #检查nova各组件的状态 nova-status upgrade check +--------------------------------+ | 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 | +--------------------------------+ | Check: Request Spec Migration | | Result: Success | | Details: None | +--------------------------------+ | Check: Console Auths | | Result: Success | | Details: None | +--------------------------------+

浙公网安备 33010602011771号