OpenStack Ocata 安装(四)安装计算(Nova)服务

15、安装计算(Nova)服务

      使用OpenStack Compute来托管和管理云计算系统。

       OpenStackCompute可以在标准硬件上横向扩展,并下载图像到启动实例。

Nova下的子类:

nova-api服务接收和响应终端用户计算API调用。

nova-api-metadata服务接受从实例元数据请求。

nova-compute服务工人守护进程创建和终止虚拟机实例通过 hypervisor APIs。

nova-consoleauth守护程序控制台代理提供的授权用户令牌。

nova-novncproxy守护进程提供了一个代理来访问运行的实例通过VNC连接。

nova-spicehtml5proxy提供通过SPICE连接访问运行实例的代理。

 

创建该服务的数据库和数据库管理账户

controller#

mysql -u root -p123

 

CREATE DATABASE nova_api;

CREATE DATABASE nova;

CREATE DATABASE nova_cell0;

 

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';

exit

 

创建nova用户、服务、API

controller#

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

此处需要输入密码:

 

openstack role add --project service --usernova admin

 

openstack service create --name nova \

--description "OpenStack Compute"compute

 

openstack endpoint create --regionRegionOne compute public http://controller:8774/v2.1

openstack endpoint create --regionRegionOne compute internal http://controller:8774/v2.1

openstack endpoint create --regionRegionOne compute admin http://controller:8774/v2.1

 

创建placement用户、服务、API

controller#

openstack user create --domain default--password-prompt placement

此处需要输入密码:

 

openstack role add --project service --userplacement admin

 

openstack service create --name placement--description "Placement API" placement

 

创建API时按照OpenStack官网的操作会有报错

openstack endpoint create --region RegionOne placement publichttp://controller/placement

openstack endpoint create --region RegionOne placementinternal http://controller/placemen

openstack endpoint create --region RegionOne placement adminhttp://controller/placement

报错提示

Failed to create resourceprovider record in placement API for. Got 404: <!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 NotFound</title>

</head><body>

<h1>NotFound</h1>

<p>The requestedURL /placement/resource_providers was not found on this server.</p>

</body></html>

解决办法:

查看APIID,然后根据ID删除原来配置的三个API

openstack endpoint service list

openstack endpoint delete service_ID

然后在使用以下API

openstack endpoint create --region RegionOne placementpublic http://controller:8778

openstack endpoint create --region RegionOne placementadmin http://controller:8778

openstack endpoint create --region RegionOne placementinternal http://controller:8778

 

推荐直接使用

openstack endpoint create --regionRegionOne placement public http://controller:8778

openstack endpoint create --regionRegionOne placement admin http://controller:8778

openstack endpoint create --regionRegionOne placement internal http://controller:8778

 

配置nova配置文件(备份配置文件,删除配置文件里的所有数据,使用提供的配置):

controller#

cp /etc/nova/nova.conf /etc/nova/nova.conf.bak

vi /etc/nova/nova.conf

 

[DEFAULT]

enabled_apis = osapi_compute,metadata

transport_url =rabbit://openstack:openstack@controller

#本机IP地址

my_ip = 192.168.215.100

use_neutron = True

firewall_driver = nova.virt.firewall.NoopFirewallDriver

 

[api_database]

connection =mysql+pymysql://nova:nova@controller/nova_api

 

[database]

connection =mysql+pymysql://nova:nova@controller/nova

 

[api]

auth_strategy = keystone

 

[keystone_authtoken]

auth_uri = http://controller:5000

auth_url = http://controller:35357

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = nova

password = nova

 

[vnc]

enabled = true

vncserver_listen = $my_ip

vncserver_proxyclient_address = $my_ip

 

[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:35357/v3

username = placement

password = placement

 

修改nova的HTTP配置文件

(由于包错误,您必须启用对Placement API的访问,在文件末尾添加。)

controller#

vi/etc/httpd/conf.d/00-nova-placement-api.conf

 

<Directory /usr/bin>

<IfVersion >= 2.4>

Require all granted

</IfVersion>

<IfVersion < 2.4>

Order allow,deny

Allow from all

</IfVersion>

</Directory>

 

同步数据库

controller#

su -s /bin/sh -c "nova-manage api_dbsync" nova

 

su -s /bin/sh -c "nova-manage cell_v2map_cell0" nova

 

su -s /bin/sh -c "nova-manage cell_v2create_cell --name=cell1 --verbose" nova

 

su -s /bin/sh -c "nova-manage dbsync" nova

 

查看cell_v2所生成的UUID

controller#

nova-manage cell_v2 list_cells

 

开机自启动和启动服务

controller#

systemctl enable openstack-nova-api.service\

openstack-nova-consoleauth.serviceopenstack-nova-scheduler.service \

openstack-nova-conductor.serviceopenstack-nova-novncproxy.service

 

systemctl restartopenstack-nova-api.service \

openstack-nova-consoleauth.serviceopenstack-nova-scheduler.service \

openstack-nova-conductor.serviceopenstack-nova-novncproxy.service

 

16、配置计算节点的计算服务

配置nova配置文件(备份配置文件,删除配置文件里的所有数据,使用提供的配置):

compute#

vi /etc/nova/nova.conf

 

[DEFAULT]

enabled_apis = osapi_compute,metadata

transport_url =rabbit://openstack:openstack@controller

use_neutron = True

firewall_driver =nova.virt.firewall.NoopFirewallDriver

#本机IP地址

my_ip = 192.168.215.101

 

[api]

auth_strategy = keystone

 

[keystone_authtoken]

auth_uri = http://controller:5000

auth_url = http://controller:35357

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = nova

password = nova

 

[vnc]

enabled = True

vncserver_listen = 0.0.0.0

vncserver_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:35357/v3

username = placement

password = placement

 

 [libvirt]

virt_type = qemu

 

 

[libvirt]说明:

确定您的计算节点是否支持虚拟机的硬件加速:

$ egrep -c'(vmx | svm)'/ proc / cpuinfo

如果这个命令返回一个或多个,你的计算机支持硬件加速这通常不需要额外的配置。

如果此命令返回值为零,则您的计算节点不支持硬件加速您必须配置libvirt以使用QEMU而不是KVM。

由于本人使用VMware虚拟机创建计算节点,所以使用qemu虚拟化。

 

开机自启动和启动服务

compute#

systemctl enable libvirtd.serviceopenstack-nova-compute.service

 

systemctl restart libvirtd.serviceopenstack-nova-compute.service

 

 

在控制节点上查看前面所有的服务搭建详情

controller#

openstack hypervisor list

 

openstack compute service list

 

openstack catalog list

 

openstack image list

 

 

在控制节点上发现计算节点:

controller#

1)命令方式,每次新增计算节点时都需要执行。

su -s /bin/sh -c "nova-manage cell_v2discover_hosts --verbose" nova

 

2)或者,修改配置文件方式,每隔300s自动发现计算节点。

vi /etc/nova/nova.conf

 

[scheduler]

discover_hosts_in_cells_interval = 300

 

 

发布了221 篇原创文章 · 获赞 289 · 访问量 94万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 酷酷鲨 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览