OpenStack-M版(Mitaka)搭建基于(Centos7.2)+++五、Openstack计算服务(nova)上

五、Openstack计算服务(nova)上


简单介绍:

nova控制节点上主要有五个组件:nova-api、nova-conductor、nova-consoleauth、nova-novncproxy、nova-scheduler

nova-api:接收和响应客户的API调用

nova-conductor:作用于``nova-compute``服务与数据库之间,因为nova-compute不会直接访问数据库而是交给它

nova-consoleauth:负责对访问虚拟机控制台提供token认证

nova-novncproxy:基于WEB浏览器的VNC访问提供一个代理,用于访问正在运行的实例

nova-scheduler:虚拟机调度服务负责绝对在哪个计算安装虚拟机


安装

nova安装在控制节点的部分(nova-api、nova-conductor、nova-consoleauth、nova-novncproxy、nova-scheduler


进入SQL创建nova数据库并授予权限

mysql -uroot -p

CREATE DATABASE nova_api;

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
  IDENTIFIED BY '123456';

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
  IDENTIFIED BY '123456';

CREATE DATABASE nova;

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
  IDENTIFIED BY '123456';

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
  IDENTIFIED BY '123456';


创建nova用户

需要管理员权限

. admin-openrc


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

添加  admin 角色到  nova 用户和  service 项目上

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

创建``nova``服务实体

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


创建计算服务的 API 端点 创建时括号前加 "\"  转义字符 ,如:\ (tenant_id\ )s

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1/%(tenant_id)s

openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1/%(tenant_id)s

openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1/%(tenant_id)s


安装nova软件包

yum install openstack-nova-api \
openstack-nova-conductor \
openstack-nova-console \
openstack-nova-novncproxy \
openstack-nova-scheduler


修改 /etc/nova/nova.conf文件

vi /etc/nova/nova.conf

[DEFAULT]
enabled_apis = osapi_compute,metadata启用计算和元数据API
rpc_backend = rabbit启用消息队列
auth_strategy = keystone启用keystone认证
my_ip = 192.168.100.10使用控制节点管理接口ip
use_neutron = True启用网络服务
firewall_driver = nova.virt.firewall.NoopFirewallDriver

配置数据库连接

[api_database]
connection = mysql+pymysql://nova:123456@controller/nova_api

[database]
connection = mysql+pymysql://nova:123456@controller/nova

配置消息队列

[oslo_messaging_rabbit] 
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456

配置认证服务访问

[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 = 123456

配置VNC代理使用控制节点的管理接口IP地址

[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip

配置镜像服务 API 的位置

[glance]
api_servers = http://controller:9292

配置锁路径

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

同步compute数据库

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

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

查看是否有数据

mysql -uroot -p

use nova;
show tables;

use nova_api;
show tables;

如果没有数据检查[database]和[api_database]下connection=是否正确,如果没有问题可能是赋予nova数据库权限时有误,重新赋予。

启动服务

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


如果你启动失败请检查配置文件,一般是敲错了

你可能感兴趣的:(Openstack,Mitaka版双节点部署)