openstack服务包含以下功能
服务 | 功能 | nova-api service | 接受并响应最终用户的计算API调用。该服务支持OpenStack计算API。它强制执行一些策略并启动大多数编排活动,例如运行实例。 | nova-api-metadata service | 接受来自实例的元数据请求。 | nova-compute service | 通过虚拟机监控程序API创建和终止虚拟机实例的工作程序守护程序。例如: KVM或QEMU的libvirt VMwareAPI for VMware 处理相当复杂。基本上,守护进程接受队列中的操作,并执行一系列系统命令,例如启动KVM实例并更新其在数据库中的状态。 | nova-scheduler service | 从队列中获取虚拟机实例请求,并确定它在哪个计算服务器主机上运行。 | nova-conductor module | 调解nova compute服务和数据库之间的交互。它消除了nova compute服务对云数据库的直接访问。nova导体模块水平缩放。但是,nova不在运行计算服务的节点上部署。 | nova-novncproxy daemon | 提供一个代理,用于通过VNC连接访问正在运行的实例。支持基于浏览器的novnc客户端。 | nova-spicehtml5proxy daemon | 为通过SPICE连接访问正在运行的实例提供代理。支持基于浏览器的HTML5客户端。 |
1、openstack版本 :rocky
2、linux版本:centos7
3、有$符号的是命令,没有的是文本,本文代码中#号为注释
目录
1、安装和配置控制节点
?2、安装和配置计算节点
1、安装和配置控制节点
(1)数据库配置
$ mysql -u root -p
#输入mysql密码
#创建nova_api, nova, and nova_cell0数据库
$ CREATE DATABASE nova_api;
$ CREATE DATABASE nova;
$ 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
(2)创建openstack用户?
$ source admin-openstack.sh
$ openstack user create --domain default --password-prompt nova
User Password:1234
Repeat User Password:1234
#注意密码
$ openstack role add --project service --user nova admin
(3)创建nova服务实体
$ openstack service create --name nova \
--description "OpenStack Compute" compute
?(4)创建计算API服务端点:
$ 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
?(5)安装和配置组件
$ yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-novncproxy openstack-nova-scheduler
?编辑/etc/nova/nova.conf文件 注意三个地方的密码
$ vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:openstack@controller:5672/
my_ip = 192.168.100.101
[api_database]
connection = mysql+pymysql://nova:nova@controller/nova_api
[database]
connection = mysql+pymysql://nova:nova@controller/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 1234
#在[DEFAULT]部分,配置my_ip选项以使用控制器节点的管理接口ip地址:
配置/etc/nova/nova.conf文件,跟上一节一样
[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_PASS
#注意placement用户的密码
填充nova api数据库:
$ 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
?填充nova数据库:
$ su -s /bin/sh -c "nova-manage db sync" nova
验证nova cell0和cell1已正确注册:
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" 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
?2、安装和配置计算节点
# 安装包
$ yum install openstack-nova-compute
编辑/etc/nova/nova.conf 文件
[DEFAULT]
enabled_apis = osapi_compute,metadata
[DEFAULT]
transport_url = rabbit://openstack:openstack@controller
?注意rabbitmq的密码
[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 1234
[DEFAULT]
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
#替换 MANAGEMENT_INTERFACE_IP_ADDRESS为计算节点上管理网路的ip
[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 1234
[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
?确定计算节点是否支持虚拟机的硬件加速:
$ egrep -c '(vmx|svm)' /proc/cpuinfo
?如果此命令返回一个1或更大的值,则计算节点支持硬件加速,通常不需要额外配置。 如果此命令返回的值为零,则计算节点不支持硬件加速,必须将libvirt配置为使用QEMU而不是KVM。
$ vim /etc/nova/nova.conf
[libvirt]
virt_type = qemu
完成安装
$ systemctl enable libvirtd.service openstack-nova-compute.service
$ systemctl start libvirtd.service openstack-nova-compute.service
以下命令之在控制节点上运行:
?将计算节点添加到单元数据库
$ source admin-openstack.sh
$ openstack compute service list --service nova-compute
发现计算主机:
$ su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
?添加新计算节点时,必须在控制器节点上运行nova manage cell_v2 discover_hosts以注册这些新计算节点。或者,可以在/etc/nova/nova中设置适当的间隔。形态:
$ vim /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300
|