五、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
openstack role add --project service --user nova admin
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
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
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;
启动服务
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
如果你启动失败请检查配置文件,一般是敲错了