Q版 nova安装
- 前言
- 一、简介
- 二、安装
-
- 1、前提条件
- 2、安装和配置-controller
-
- 修改配置文件
-
- nova.conf
- 00-nova-placement-api.conf
- 初始化数据库
-
- 验证:
- 设置开机自启并启动:
- 3、安装和配置-compute
-
- 修改配置文件
-
- nova.conf
- 设置开机自启并启动服务
- 4、手动添加节点
- vim /etc/nova/nova.conf
-
-
- 5、服务验证
-
前言
OpenStack项目是一个开源云计算平台,支持所有类型的云环境。该项目旨在实现简单的实现,大规模的可伸缩性和丰富的功能。来自世界各地的云计算专家为该项目做出了贡献。OpenStack通过各种补充服务提供了基础架构即服务(IaaS)解决方案。每个服务都提供一个促进此集成的应用程序编程接口(API)。
一、简介
使用OpenStack Compute托管和管理云计算系统。OpenStack Compute是基础架构即服务(IaaS)系统的主要部分。主要模块是用Python实现的。
OpenStack Compute与OpenStack Identity交互以进行身份??验证;用于磁盘和服务器映像的OpenStack映像服务;和用于用户和管理界面的OpenStack仪表板。图像访问受项目和用户的限制;每个项目都限制配额(例如,实例数)。OpenStack Compute可以在标准硬件上水平扩展,并下载映像以启动实例。
二、安装
1、前提条件
还是老样子创建数据库并创建访问用户,
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '123';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123';MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '123';MariaDB [(none)]> exit
创建nova用户并向nova用户添加admin角色:
# source admin-openrc
# openstack user create --domain default --password-prompt nova
# 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
创建placement用户并将Placement用户添加admin角色:
# openstack user create --domain default --password-prompt placement
# openstack role add --project service --user placement admin
创建Placement 实体:
# openstack service create --name placement --description "Placement API" placement
创建Placement API服务端点:
# 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
2、安装和配置-controller
# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
修改配置文件
nova.conf
# vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata #仅启用计算和元数据API:
transport_url = rabbit://openstack:123@controller #配置RabbitMQ消息队列访问:
my_ip = 192.168.144.10 #配置my_ip选项以使用控制器节点的管理接口IP地址:
use_neutron = True #启用对网络服务的支持:
firewall_driver = nova.virt.firewall.NoopFirewallDriver
配置数据库访问:
[api_database]
connection = mysql+pymysql://nova:123@controller/nova_api
[database]
connection = mysql+pymysql://nova:123@controller/nova
配置身份服务访问:
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123
将VNC代理配置为使用控制器节点的管理接口IP地址:
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
配置图像服务API的位置:
[glance]
api_servers = http://controller:9292
配置锁定路径:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
配置Placement API:
[placement]
os_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 = 123
00-nova-placement-api.conf
由于某些原因我们需要修改一个文件保证placement可以正常访问,
# vim /etc/httpd/conf.d/00-nova-placement-api.conf
<Directory /usr/bin>
= 2.4>
Require all granted
<IfVersion < 2.4>
Order allow,deny
Allow from all
重启下http服务,保证修改正确
# systemctl restart httpd
初始化数据库
# 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-manage cell_v2 list_cells
查看下数据库中情况
# mysql -uroot -pXylong_000
MariaDB [(none)]> show databases;
MariaDB [(none)]> use nova
MariaDB [nova]> show tables;
MariaDB [nova]> use nova_api
MariaDB [nova_api]> show tables;
MariaDB [nova_api]> use nova_cell0
MariaDB [nova_cell0]> 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 enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl is-active openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
3、安装和配置-compute
# yum install openstack-nova-compute
修改配置文件
nova.conf
# vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata #仅启用计算和元数据API:
transport_url = rabbit://openstack:123@controller #配置RabbitMQ消息队列访问:
my_ip = 192.168.144.11 #配置my_ip选项:
use_neutron = True #启用对网络服务的支持:
firewall_driver = nova.virt.firewall.NoopFirewallDriver
配置身份服务访问:
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123
启用和配置远程控制台访问:
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
配置图像服务API的位置:
[glance]
api_servers = http://controller:9292
配置锁定路径:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
配置Placement API:
[placement]
os_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 = 123
compute节点是要承载启动虚机的职责的,所以需要开启虚拟化,如果不想开启也是可以配置qemu方式的,我的是虚机已经开启了,
# egrep -c '(vmx|svm)' /proc/cpuinfo
设置开机自启并启动服务
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
# systemctl is-active libvirtd.service openstack-nova-compute.service
4、手动添加节点
# source admin-openrc
# openstack compute service list --service nova-compute
# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
添加新的计算节点时,必须在控制器节点上运行以注册这些新的计算节点。另外,还可以在nova.conf中设置适当的间隔 :
vim /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300
5、服务验证
列出服务组件以验证每个进程的成功启动和注册:
# source admin-openrc
# openstack compute service list
列出身份服务中的API端点以验证与身份服务的连接性:
# openstack catalog list
列出图像服务中的图像以验证与图像服务的连接性:
# openstack image list
检查单元格和展示位置API是否正常运行:
# nova-status upgrade check