lightlanguage 2019-12-03
一、实验目的:
1、理解nova服务在OpenStack中的作用
2、掌握在控制节点上安装配置nova的方法和步骤
3、掌握在计算节点上安装与配置nova的方法和步骤
二、实验步骤:
1、在controller节点上为nova创建数据库,并创建管理账号,参考命令
建立nova的数据库:
#mysql -u root -p (用数据库连接客户端以 root 用户连接到数据库服务器)
#CREATE DATABASE nova_api;
#CREATE DATABASE nova; (创建 nova_api 和 nova 数据库:)
#CREATE DATABASE nova_cell0;
对数据库进行正确的授权:
#GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘密码‘;
#GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘密码‘;
#GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘密码‘;
#GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘密码‘;
#GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘localhost‘ \
IDENTIFIED BY ‘密码‘;
#GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘%‘ \
IDENTIFIED BY ‘密码‘;
创建三个数据库:
授权:
2、在keystone中为nova创建用户、角色、服务和API接口,参考命令
#. admin-openrc
创建nova用户:
#openstack user create --domain default --password-prompt nova
#openstack role add --project service --user nova admin
把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
#openstack user create --domain default --password-prompt placement
#openstack role add --project service --user placement admin
#openstack service create --name placement --description "Placement API" placement
#openstack endpoint create --region RegionOne placement public http://controller:8778
# openstack endpoint create --region RegionOne placement internal http://controller:8778
#openstack endpoint create --region RegionOne placement admin http://controller:8778
3、在控制节点上安装nova,参考命令如下
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api
4、参考文档修改配置文件
5、启动nova服务
重启httpd 服务:
#systemctl restart httpd
填充nova-api数据库:
#su -s /bin/sh -c "nova-manage api_db sync" nova
注册cell0数据库:
#su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
创建cell1单元格
#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是否正确注册:
nova-manage cell_v2 list_cells
正确注册:
设置开机自启动
#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
6、安装并配置计算节点
7、验证
#. admin-openrc
#openstack compute service list
这里有问题,status应该为up,后来查阅了很多资料修改正确
此供参考
输出正常即为配置正确
#openstack catalog list
#openstack image list
#nova-status upgrade check