注意要 按顺序 搭建服务,在 CentOS 7 安装 Openstack Rocky 版本 - 环境搭建 的基础上安装服务。
Compute service - 计算服务(Nova + Placement)
在 控制节点 和 计算节点 安装,之后安装网络服务(Neutron)后需要修改配置文件
控制节点
数据库配置
连接数据库
数据库操作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 CREATE DATABASE nova_api;CREATE DATABASE nova;CREATE DATABASE nova_cell0;CREATE DATABASE placement;GRANT ALL PRIVILEGES ON nova_api.* TO 'nova' @'localhost' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON nova_api.* TO 'nova' @'%' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON nova.* TO 'nova' @'localhost' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON nova.* TO 'nova' @'%' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova' @'localhost' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova' @'%' IDENTIFIED BY 'mariadb-nova' ;GRANT ALL PRIVILEGES ON placement.* TO 'placement' @'localhost' IDENTIFIED BY 'mariadb-placement' ;GRANT ALL PRIVILEGES ON placement.* TO 'placement' @'%' IDENTIFIED BY 'mariadb-placement' ;exit
身份认证和 API 配置
Nova
创建用户 nova
并添加到 admin
角色
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 . admin-openrc openstack user create --domain default --password-prompt nova openstack role add --project service --user nova admin
创建 nova
服务实体和端点(endpoint)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 openstack service create --name nova --description "OpenStack Compute" compute 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
角色
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 openstack user create --domain default --password-prompt placement openstack role add --project service --user placement admin
创建 placement
服务实体和端点(endpoint)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 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
安装和配置 Nova
安装软件包
1 2 3 4 yum install openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy \ openstack-nova-scheduler openstack-nova-placement-api -y
编辑配置文件 /etc/nova/nova.conf
,配置文件中有些选项是没有的,需要直接添加到相应的小节
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 [DEFAULT] enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:rabbitmq@controller my_ip = 10.0.0.11 use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] connection = mysql+pymysql://nova:mariadb-nova@controller/nova_api [database] connection = mysql+pymysql://nova:mariadb-nova@controller/nova [placement_database] connection = mysql+pymysql://placement:mariadb-placement@controller/placement [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 = nova # [neutron] # url = http://controller:9696 # auth_url = http://controller:5000 # auth_type = password # project_domain_name = default # user_domain_name = default # region_name = RegionOne # project_name = service # username = neutron # password = neutron [vnc] enabled = true server_listen = $my_ip server_proxyclient_address = $my_ip [glance] api_servers = http://controller:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp [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 = placement
修改配置文件 /etc/httpd/conf.d/00-nova-placement-api.conf
,添加以下内容,启用对 Placement API 的访问
1 2 3 4 5 6 7 8 9 <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory>
重启 http 服务
1 2 systemctl restart httpd
继续配置 nova
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova systemctl enable openstack-nova-api.service \ openstack-nova-consoleauth openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl restart openstack-nova-api.service \ openstack-nova-consoleauth openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service
计算节点
安装和配置 nova
安装软件包
1 2 yum install openstack-nova-compute -y
修改配置文件 /etc/nova/nova.conf
,缺失的配置选项直接添加到相应的小节
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 [DEFAULT] enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:rabbitmq@controller my_ip = 10.0.0.31 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 = nova # [neutron] # url = http://controller:9696 # auth_url = http://controller:5000 # auth_type = password # project_domain_name = default # user_domain_name = default # region_name = RegionOne # project_name = service # username = neutron # password = neutron [vnc] enabled = true server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080/vnc_auto.html [glance] api_servers = http://controller:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp [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 = placement [libvirt] virt_type = qemu
完成安装
1 2 3 4 5 6 egrep -c '(vmx|svm)' /proc/cpuinfo systemctl enable libvirtd.service openstack-nova-compute.service systemctl start libvirtd.service openstack-nova-compute.service
如果启动 nova 服务卡住了,但是查看日志 /var/log/nova/nova-compute.log
只有普通信息输出,那可能是没关 防火墙
1 2 3 4 5 6 7 8 systemctl stop firewalld.service systemctl disable firewalld.service sudo setenforce 0
添加到 cell 数据库
在 控制节点 上执行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 . admin-openrc openstack compute service list --service nova-compute su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova vim /etc/nova/nova.conf
验证
在 控制节点 上执行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 . admin-openrc openstack compute service list openstack catalog list openstack image list nova-status upgrade check