第六部分 安装计算服务nova(控制节点)
计算服务nova较之前的服务稍显复杂(但没有网络服务neutron复杂),它需要在控制节点和计算节点都安装
控制节点主要安装nova-api(nova主服务)、nova-scheduler(nova调度服务)、nova-conductor(nova数据库服务,提供数据库访问)、nova-novncproxy(nova的vnc服务,提供实例的控制台)等服务;
计算节点主要安装nova-compute(nova计算服务)。
本节将叙述在控制节点上安装nova的步骤,下一节再叙述在计算节点上的安装。
在控制节点按如下操作安装nava计算服务(控制节点)
安装数据库(共3个数据库)
mysql -u root -p
创建nova_api,nova和nova_cell0数据库
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
授予数据库的适当访问权限(共6条语句)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> exit;
创建nova用户
. admin-openrc
openstack user create --domain default --password NOVA_PASS nova
向nova用户添加admin角色
openstack role add --project service --user nova admin
创建nova服务实体
openstack service create --name nova --description "OpenStack Compute" compute
创建Compute API服务端点
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
安装软件包
yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y
修改配置文件
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
grep -Ev '^$|#' /etc/nova/nova.conf.bak >/etc/nova/nova.conf
vim /etc/nova/nova.conf
在[DEFAULT]加入:
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@ct:5672/
my_ip = 192.168.10.41
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
在[api_database]和[database]加入:
[api_database]
connection = mysql+pymysql://nova:NOVA_DBPASS@ct/nova_api
[database]
connection = mysql+pymysql://nova:NOVA_DBPASS@ct/nova
在[api]和[keystone_authtoken]加入:
[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://ct:5000/
auth_url = http://ct:5000/
memcached_servers = ct:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = NOVA_PASS
在[vnc]加入:
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
在[glance]加入:
[glance]
api_servers = http://ct:9292
在[oslo_concurrency]加入:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
在[placement]加入:
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://ct:5000/v3
username = placement
password = PLACEMENT_PASS
ps:修改的地方较多,请细心修改。
填充nova-api数据库
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
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
启动计算服务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查看端口情况,如出现8774和8775端口则表示nova服务正常启动。
curl http://ct:8774