码迷,mamicode.com
首页 > 其他好文 > 详细

openstack (六) nova 计算组件部署

时间:2020-01-05 11:50:29      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:one   str   tar   同步   err   yum   cli   restful   memcache   

1.组件详解

功能:托管和管理虚拟主机

 

技术图片 选主机: 用户请求 -> nova-api -> queue -> nova-scheduler -> nova-db(过滤+权重) -> nova-scheduler -> queue

 

创建VM: nova-compute -> queue -> nova-conductor -> nava-db -> nova-conductor -> queue -> nova-compute -> 获取相应的资源 -> hypervisor -> 创建VM

访问VM:

命令行

浏览器:nova-console -> nova-cert -> nova-console

  • 组件介绍

API组件:

nova-api:负责接收和响应外部的操作请求,RESTful格式的API,是外部访问Nova的唯一途径。

nova-api-metadata:是nova-api的一个子服务,为VM实例的创建提供metadata信息。

Compute Core组件:

nova-scheduler:负责VM实例的资源调度,通过过滤和权重计算,来决策VM实例创建在哪个计算节点上。

nova-compute:管理VM实例,通过消息队列接收请求,并承担操作工作。

nova-conductor:nova-compute借助nava-conductor实现对数据库的访问

Console Interface组件:

nova-cert:负责身份认证

nova-consoleauth:用户控制台的授权验证

nova-novncproxy:VNC代理,支持基于浏览器的vnc客户端

2.控制节点部署

  • 数据库配置
$ mysql -u root -p
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‘;

复制代码
  • 软件安装
# yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
复制代码
  • 配置文件修改

修改nova.conf文件

vim /etc/nova/nova.conf
[DEFAULT]
# 开发nova服务的api接口,直接取消注释
enabled_apis = osapi_compute,metadata
[api_database]
# 配置nova-api的数据库连接地址
connection = mysql+pymysql://nova:nova@controller/nova_api

[database]
# 配置nova的数据库链接地址
connection = mysql+pymysql://nova:nova@controller/nova
[DEFAULT]
# 配置rabbitmq的链接地址
transport_url = rabbit://openstack:openstack@controller
[api]
# 配置api验证方式,取消注释
auth_strategy = keystone

[keystone_authtoken]
# 配置keystone的认证信息
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 = nova
[DEFAULT]
# 配置ip
my_ip = 192.168.188.100
[DEFAULT]
# 配置使用的网络信息,直接取消注释即可,关闭防火墙驱动
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[vnc]
enabled = true
# 开启vnc功能,配置vnc的联系方式
server_listen = $my_ip
server_proxyclient_address = $my_ip
[glance]
# 配置glance的联系地址
api_servers = http://controller:9292
[oslo_concurrency]
# 配置锁文件路径
lock_path = /var/lib/nova/tmp
[placement]
# 配置资源跟踪用户placement的认证信息
os_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-api的配置文件

vim /etc/httpd/conf.d/00-nova-placement-api.conf <Directory /usr/bin> = 2.4> Require all granted <IfVersion < 2.4> Order allow,deny Allow from all

重启http服务

systemctl restart httpd

  • 信息同步

同步nova-api数据库信息和cell0数据库信息

# su -s /bin/sh -c "nova-manage api_db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
复制代码

创建cell1记录,同步nova数据库信息

# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
# su -s /bin/sh -c "nova-manage db sync" nova
复制代码
  • 权限配置

加载admin用户环境变量

source admin-openstack.sh

增加一个nova用户

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

将nova用户加入到service项目的admin角色组

openstack role add --project service --user nova admin

创建nova服务,配置api地址记录

openstack service create --name nova --description "OpenStack Compute" compute
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
复制代码

创建placement用户,该用户用于资源的追踪记录。加入到service项目的admin角色组

$ openstack user create --domain default --password placement placement
$ openstack role add --project service --user placement admin
复制代码

创建placement服务,配置api地址记录

$ openstack service create --name placement --description "Placement API" placement
$ 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
复制代码
  • 验证效果
# systemctl enable openstack-nova-api.service  openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service
openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service  openstack-nova-consoleauth.service openstack-nova-scheduler.service  openstack-nova-conductor.service openstack-nova-novncproxy.service
复制代码

验证各服务的endpoint

openstack catalog list

日志记录

/var/log/nova

3.计算节点部署

  • 准备工作

安装软件

yum install -y openstack-nova-compute sysfsutils libguestfs-tools

  • 修改配置文件
修改nova.conf配置文件
vim /etc/nova/nova.conf
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@controller
[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 = nova
[DEFAULT]
# ...
my_ip = 192.168.188.101 #计算节点的IP地址
[DEFAULT]
# ...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[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]
# ...
os_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

#Determine whether your compute node supports hardware acceleration for virtual machines:
#If this command returns a value of one or greater, your compute node supports hardware acceleration which typically requires no additional configuration.
#If this command returns a value of zero, your compute node does not support hardware acceleration and you must configure libvirt to use QEMU instead of KVM.
[libvirt]
# ...
virt_type = qemu
复制代码
[DEFAULT]
# 调整计算节点提供的资源参数(因为学习环境底层是VMware虚拟机)
vif_plugging_is_fatal=false
vif_plugging_timeout=10
复制代码

开启服务并设置开机自启

# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
复制代码
  • 效果测试

控制节点添加计算节点

source admin-openstack.sh
oepnstack compute service list
复制代码

新增计算节点记录,添加到nova数据库中

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

验证所有API是否正常

nova-status upgrade check



openstack (六) nova 计算组件部署

标签:one   str   tar   同步   err   yum   cli   restful   memcache   

原文地址:https://www.cnblogs.com/well-666/p/12151578.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!