Openstack云计算:openstack rocky部署三:nova 部署与验证(控制节)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Openstack云计算:openstack rocky部署三:nova 部署与验证(控制节)相关的知识,希望对你有一定的参考价值。

Openstack 云计算(二): Openstack Rocky部署三 nova 部署与验证 (控制节点)

标签(空格分隔): openstack系列


  • 一: nova 的部署
  • 二: nova 验证

一: nova的部署

###1.1 nova 数据库创建

mysql -uroot -p flyfish225

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 ‘nova‘;
GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;

GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘nova‘;
GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;

GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘nova‘;
GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;

GRANT ALL PRIVILEGES ON placement.* TO ‘placement‘@‘localhost‘ IDENTIFIED BY ‘placement‘;
GRANT ALL PRIVILEGES ON placement.* TO ‘placement‘@‘%‘ IDENTIFIED BY ‘placement‘;

flush privileges;
show databases;
select user,host from mysql.user;

技术图片

技术图片

技术图片

1.2 在keystone上面注册nova服务

openstack user create --domain default --password=nova nova
openstack user list

技术图片

在keystone上将nova用户配置为admin角色并添加进service项目
openstack role add --project service --user nova admin

技术图片

创建nova计算服务的实体

openstack service create --name nova --description "OpenStack Compute" compute
openstack service list

技术图片

创建计算服务的API端点(endpoint)

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1

openstack endpoint list

技术图片

技术图片

这个版本的nova增加了placement项目

同样,创建并注册该项目的服务证书

openstack user create --domain default --password=placement placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement

技术图片

创建placement项目的endpoint(API端口)

openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
openstack endpoint list

技术图片

技术图片

在控制节点安装nova相关服务 

yum install openstack-nova-api openstack-nova-conductor   openstack-nova-console openstack-nova-novncproxy   openstack-nova-scheduler openstack-nova-placement-api -y

openstack-config --set  /etc/nova/nova.conf DEFAULT enabled_apis  osapi_compute,metadata
openstack-config --set  /etc/nova/nova.conf DEFAULT my_ip 10.0.0.11
openstack-config --set  /etc/nova/nova.conf DEFAULT use_neutron  true 
openstack-config --set  /etc/nova/nova.conf DEFAULT firewall_driver  nova.virt.firewall.NoopFirewallDriver
openstack-config --set  /etc/nova/nova.conf DEFAULT transport_url  rabbit://openstack:[email protected]
openstack-config --set  /etc/nova/nova.conf api_database connection  mysql+pymysql://nova:[email protected]/nova_api
openstack-config --set  /etc/nova/nova.conf database connection  mysql+pymysql://nova:[email protected]/nova
openstack-config --set  /etc/nova/nova.conf placement_database connection  mysql+pymysql://placement:[email protected]/placement
openstack-config --set  /etc/nova/nova.conf api auth_strategy  keystone 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_url  http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf keystone_authtoken memcached_servers  controller:11211
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_type  password
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_domain_name  default 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken user_domain_name  default
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_name  service 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken username  nova 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken password  nova
openstack-config --set  /etc/nova/nova.conf vnc enabled true
openstack-config --set  /etc/nova/nova.conf vnc server_listen ‘$my_ip‘
openstack-config --set  /etc/nova/nova.conf vnc server_proxyclient_address ‘$my_ip‘
openstack-config --set  /etc/nova/nova.conf glance api_servers  http://controller:9292
openstack-config --set  /etc/nova/nova.conf oslo_concurrency lock_path  /var/lib/nova/tmp 
openstack-config --set  /etc/nova/nova.conf placement region_name RegionOne
openstack-config --set  /etc/nova/nova.conf placement project_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement project_name service
openstack-config --set  /etc/nova/nova.conf placement auth_type password
openstack-config --set  /etc/nova/nova.conf placement user_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement auth_url http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf placement username placement
openstack-config --set  /etc/nova/nova.conf placement password placement
openstack-config --set  /etc/nova/nova.conf scheduler discover_hosts_in_cells_interval 300

技术图片

技术图片

egrep -v "^#|^$" /etc/nova/nova.conf

技术图片

修改nova的虚拟主机配置文件
cp /etc/httpd/conf.d/00-nova-placement-api.conf /etc/httpd/conf.d/00-nova-placement-api.conf.bak

vim /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 zhangyy
<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计算服务的软件包安装完成

1.3 同步nova数据(注意同步顺序)

 nova_api有32张表,placement有32张表,nova_cell0有110张表,nova也有110张表

 初始化nova-api和placement数据库

 su -s /bin/sh -c "nova-manage api_db sync" nova

 mysql -h10.0.0.11 -unova -pnova -e "use nova_api;show tables;"
mysql -h10.0.0.11 -uplacement -pplacement -e "use placement;show tables;"

技术图片

技术图片

nova_api和placement都有32张表,区别在于nova_api数据库的cell_mappings表多两条数据,存放的是nova和rabbitmq等的配置信息
初始化nova_cell0和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

# 初始化nova数据库

su -s /bin/sh -c "nova-manage db sync" nova
# 检查确认cell0和cell1注册成功

su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
# 验证数据库

mysql -h10.0.0.11 -unova -pnova -e "use nova_cell0;show tables;"
mysql -h10.0.0.11 -unova -pnova -e "use nova;show tables;"

技术图片

技术图片

通过对比可知,这两个数据库的表目前完全一样,区别在于nova数据库的service表中有4条数据,存放的是当前版本nova相关服务的注册信息 

检查确认cell0和cell1注册成功
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

技术图片

返回的数据存储在nova_api数据库的cell_mappings表中
启动nova服务

需要启动5个服务

systemctl start openstack-nova-api.service openstack-nova-consoleauth.service   openstack-nova-scheduler.service openstack-nova-conductor.service   openstack-nova-novncproxy.service

systemctl status openstack-nova-api.service openstack-nova-consoleauth.service   openstack-nova-scheduler.service openstack-nova-conductor.service   openstack-nova-novncproxy.service

systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service   openstack-nova-scheduler.service openstack-nova-conductor.service   openstack-nova-novncproxy.service

systemctl list-unit-files |grep openstack-nova* |grep enabled

技术图片

技术图片

技术图片

至此,在控制节点安装nova计算服务就完成了,下篇文章介绍独立的nova计算节点的安装方法

以上是关于Openstack云计算:openstack rocky部署三:nova 部署与验证(控制节)的主要内容,如果未能解决你的问题,请参考以下文章

云计算之OpenStack概述

openstack成长之旅 - 1 云计算及openstack介绍

云计算与 OpenStack - 每天5分钟玩转 OpenStack(14)

Openstack 云计算: Openstack Rocky部署一 : 系统环境初始化

openstack云计算:Openstack rocky 部署三 nova计算节点部署

开源云平台“Openstack”