openstack篇 NOVA组件概念和部署

Posted 鹧鸪鹄

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack篇 NOVA组件概念和部署相关的知识,希望对你有一定的参考价值。

文章目录

一、NOVA组件概念

Nova分为控制节点、计算节点
Nova组件核心功能是调度资源,在配置文件中需要体现的部分:指向认证节点位置(URL、ENDPOINT)、调用服务、注册、提供支持等,配置文件中的所有配置参数基本都是围绕此范围(对实例生命周期管理)进行设置

二 部署

资源配置

控制节点ct
​nova-api(nova主服务)
​nova-scheduler(nova调度服务)
​nova-conductor(nova数据库服务,提供数据库访问)
​nova-novncproxy(nova的vnc服务,提供实例的控制台)
计算节点c1、c2
nova-compute(nova计算服务)

数据库授权和创建库

create database nova_api;
create database nova;
create database nova_cell0;   创建对应的数据库
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';    授权
flush privileges;  刷新权限
exit


管理NOVA的用户和服务

openstack user create --domain default --password NOVA_PASS nova  创建NOVA组件用户用户
openstack role add --project service --user nova admin   添加管理员权限并加入服务
openstack service create --name nova --description "OpenStack Compute" compute  创建openstack服务
openstack endpoint create --region RegionOne compute public http://ct:8774/v2.1   关联端点
openstack endpoint create --region RegionOne compute internal http://ct:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://ct:8774/v2.1






安装NOVA组件

yum -y install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler
cp -a /etc/nova/nova.conf,.bak   备份配置文件
传参
grep -Ev '^$|#' /etc/nova/nova.conf.bak > /etc/nova/nova.conf   
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata  
 openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.40.10 			
 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:RABBIT_PASS@ct
 openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:NOVA_DBPASS@ct/nova_api
 openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:NOVA_DBPASS@ct/nova
 openstack-config --set /etc/nova/nova.conf placement_database connection mysql+pymysql://placement:PLACEMENT_DBPASS@ct/placement
 openstack-config --set /etc/nova/nova.conf api auth_strategy keystone
 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://ct:5000/v3
 openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers ct: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_PASS
 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://ct: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://ct:5000/v3
 openstack-config --set /etc/nova/nova.conf placement username placement
 openstack-config --set /etc/nova/nova.conf placement password PLACEMENT_PASS
 cat  /etc/nova/nova.conf  查看参数



初始化数据库

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova  创建cell单元格
su -s /bin/sh -c "nova-manage db sync" nova  同步数据到数据库
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova  检查cell0
和1是否成功
tail -f /var/log/nova/nova-manage.log  查看日志



启动NOVA服务

 systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
 systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
netstat -tnlup|egrep '8774|8775'  查看端口
curl http://ct:8774  

计算节点安装NOVA服务

yum -y install openstack-nova-compute
cp -a /etc/nova/nova.conf,.bak
grep -Ev '^$|#' /etc/nova/nova.conf.bak > /etc/nova/nova.conf
传参  两台服务器IP地址不一样
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@ct
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.40.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 api auth_strategy keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://ct:5000/v3
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers ct: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_PASS
openstack-config --set /etc/nova/nova.conf vnc enabled true
 openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address ' $my_ip'
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.1.250:6080/vnc_auto.html
openstack-config --set /etc/nova/nova.conf glance api_servers http://ct: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://ct:5000/v3
openstack-config --set /etc/nova/nova.conf placement username placement
openstack-config --set /etc/nova/nova.conf placement password PLACEMENT_PASS
openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service  


开启服务

systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service

在控制节点测试计算节点

openstack compute service list --service nova-compute
扫描当前有几个可用的计算节点
#扫描到可用节点后,会将其创建到cell中,后续就可以在cell中创建虚拟机
su -s /bin/sh -c “nova-manage cell_v2 discover_hosts --verbose” nova

修改控制nova的配置文件

vim /etc/nova/nova.conf

[scheduler]
#每300秒扫描一次
discover_hosts_in_cells_interval = 300

systemctl restart openstack-nova-api.service

验证计算节点服务

openstack compute service list

查看各个组件API是否正常

openstack catalog list

查看镜像

openstack image list

查看cell API和Placement API是否正常

nova-status upgrade check

以上是关于openstack篇 NOVA组件概念和部署的主要内容,如果未能解决你的问题,请参考以下文章

openstack篇 NOVA组件概念和部署

OpenStack入门篇之nova服务(控制节点)的部署与测试

OpenStack部署之Nova项目(7-5)

OpenStack部署之Nova项目(7-5)

OpenStack的部署T版——Nova组件

openstack篇 openstack keystone组件部署