Centos7.4安装openstack(queens)详细安装部署(四)-计算服务(nova)安装
一、创库授权
1.1、(控制节点)配置数据库
mysql -u root -pADMIN_PASS
1.2、创建nova相关数据库并设置访问权限
CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE nova_cell0; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'ADMIN_PASS';
1.3、控制节点)创建nova认证相关信息
openstack user create --domain default --password ADMIN_PASS nova openstack role add --project service --user nova admin 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 openstack user create --domain default --password ADMIN_PASS 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
二、安装服务
1.1、(控制节点)安装软件包并配置组件
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
1.2、编辑/etc/nova/nova.conf文件并完成以下配置
cp /etc/nova/nova.conf{,.bak} grep '^[a-z\[]' /etc/nova/nova.conf.bak >/etc/nova/nova.conf [DEFAULT] enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:ADMIN_PASS@controller my_ip = 10.0.0.11 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver ... [api_database] connection = mysql+pymysql://nova:ADMIN_PASS@controller/nova_api ... [database] connection = mysql+pymysql://nova:ADMIN_PASS@controller/nova ... [api] auth_strategy = keystone ... [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = ADMIN_PASS ... [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] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = ADMIN_PASS
1.3、因为软件包的bug,编辑/etc/httpd/conf.d/00-nova-placement-api.conf文件增加如下内容
<Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory>
1.4、重启httpd服务
systemctl restart httpd
1.5、导入相关数据库表结构
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 验证cell0和cell1是否成功注册
1.6、设置服务的开机自启动,并启动服务
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
三、计算节点安装服务
1.1、(计算节点)在计算节点安装计算服务
yum install openstack-nova-compute -y
1.2、编辑/etc/nova/nova.conf文件并设置如下内容
cp /etc/nova/nova.conf{,.bak} grep '^[a-z\[]' /etc/nova/nova.conf.bak >/etc/nova/nova.conf [DEFAULT] enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:ADMIN_PASS@controller my_ip = 10.0.0.31 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver ... [api] auth_strategy = keystone ... [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = ADMIN_PASS ... [vnc] enabled = True server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://10.0.0.11:6080/vnc_auto.html ... [glance] api_servers = http://controller:9292 ... [oslo_concurrency] lock_path = /var/lib/nova/tmp ... [placement] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = ADMIN_PASS
1.3、检测当前计算节点是否支持硬件虚拟化,这里返回0,不支持硬件虚拟化。
编辑/etc/nova/nova.conf文件设置qemu来提供软件虚拟化
/etc/nova/nova.conf [libvirt] virt_type = qemu cpu_mode = none
1.4、设置服务的开机自启动,并启动计算服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
1.5、(控制节点)向cell数据库添加计算节点
执行下面的命令,查看计算节点信息是否已经在数据库
openstack compute service list --service nova-compute
1.6、发现计算节点
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
1.7、控制节点)验证操作
openstack compute service list 列出计算服务的运行状态
openstack catalog list 列出认证服务的端口
openstack image list 列出镜像信息,确认能访问镜像服务
nova-status upgrade check 确认cells和placement api成功运行