- 1、安装数据库(共 3 个数据库)
- NOVA_DBPASS替换为__000000
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novaapi.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novaapi.* TO ‘nova‘@’%’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@’%’ IDENTIFIED BY ‘000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novacell0.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novacell0.* TO ‘nova‘@’%’ IDENTIFIED BY ‘_000000’;
MariaDB [(none)]>__ exit;
第六部分 安装计算服务 nova(控制节点)
计算服务 nova 较之前的服务稍显复杂(但没有网络服务 neutron 复杂),它需要在控制节点和计算节点都安装
控制节点主要安装 nova-api(nova 主服务)、nova-scheduler(nova 调度服务)、nova-conductor(nova 数据库服务,提供数据库访问)、nova-novncproxy(nova 的 vnc 服务,提供实例的控制台)等服务;
计算节点主要安装 nova-compute(nova 计算服务)。
本节将叙述在控制节点上安装 nova 的步骤,下一节再叙述在计算节点上的安装。
在控制节点按如下操作安装 nava 计算服务(控制节点)
1、安装数据库(共 3 个数据库)
创建 nova_api,nova 和 nova_cell0 数据库
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
授予数据库的适当访问权限(共 6 条语句)
NOVA_DBPASS替换为__000000
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novaapi.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novaapi.* TO ‘nova‘@’%’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@’%’ IDENTIFIED BY ‘000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novacell0.* TO ‘nova‘@’localhost’ IDENTIFIED BY ‘_000000‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON novacell0.* TO ‘nova‘@’%’ IDENTIFIED BY ‘_000000’;
MariaDB [(none)]>__ exit;
2、创建 nova 用户
. /openrc/admin_openrc
openstack user create —domain default —password 000000 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://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
安装软件包
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:000000@controller:5672/
my_ip = 192.168.100.10
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
在[api_database]和[database]加入:
[api_database]
connection = mysql+pymysql://nova:000000@controller/nova_api
[database]
connection = mysql+pymysql://nova:000000@controller/nova
在[api]和[keystone_authtoken]加入:
[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 = 000000
在[vnc]加入:
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
在[glance]加入:
[glance]
api_servers = http://controller: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://controller:5000/v3
username = placement
password = 000000
注意: 修改的地方较多,请细心修改。
3、填充 nova-api 数据库
su -s /bin/sh -c “nova-manage apidb sync” nova
su -s /bin/sh -c “nova-manage cellv2 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 服务正常启动。