Openstack安装与部署:nova服务的安装与配置

时间:2024-03-23 12:09:34

Openstack安装与部署:nova服务的安装与配置

该项所有操作在controller0主机上用root用户进行。
创建数据库并授权
#mysql -uroot -popenstack

create database database nova;
grant all privileges on nova.* to ‘nova’@’localhost’ identified by ‘NOVA_DBPASS’;
grant all privileges on nova.* to ‘nova’@’%’ identified by ‘NOVA_DBPASS’;
在创建数据库的时候,注意代码末尾的分号。
quit
验证是否创建成功(-p后不能有空格 会自动将空格也视为密码

#mysql -unova -pNOVA_DBPASS -e ‘show databases;’
Openstack安装与部署:nova服务的安装与配置
创建kestone认证用户
#source /root/admin-openrc.sh 刷新环境变量
#keystone user-create --name nova --pass NOVA_PASS --email [email protected] --enabled true
#keystone user-list

如果出现警告信息则重新配置环境变量
Openstack安装与部署:nova服务的安装与配置
赋予nova用户admin权限
#keystone user-role-add --user nova --tenant service --role admin
#keystone user-role-list --user nova --tenant service

Openstack安装与部署:nova服务的安装与配置
创建nova服务并注册到keystone中
#keystone service-create --name nova --type computer --description “Openstack Nova Computer Service”
#keystone service-list

Openstack安装与部署:nova服务的安装与配置
#keystone endpoint-create --service-id $(keystone service-list | awk ‘/computer /{print $2}’) --publicurl http://controller0:8774/v2/%(tenant_id)s --adminurl http://controller0:8774/v2/%(tenant_id)s --region regionOne
#keystone endpoint-list

Openstack安装与部署:nova服务的安装与配置
安装和配置nova
#yum update yum源更新
#yum -y install openstack-nova-cert openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler python-novaclient

配置数据库连接
#openstack-config --set /etc/nova/nova.conf database connection mysql://nova:[email protected]/nova
#cat /etc/nova/nova.conf | grep mysql

当配置命令写错或配置文件没有改变时,直接打开配置文件进行修改。
Openstack安装与部署:nova服务的安装与配置
配置rabbit
#openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
#openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_host controller0
#openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_port 5672
#openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_userid nova
#openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_password NOVA_MQPASS
#openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_virtual_host /
#cat /etc/nova/nova.conf | grep rabbit

Openstack安装与部署:nova服务的安装与配置
配置keystone认证信息
#openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
#openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller0:5000/v2.0
#openstack-config --set /etc/nova/nova.conf keystone_authtoken identity_uri http:controller0:35357
#openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
#openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
#openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password NOVA_PASS

#cat /etc/nova/nova.conf |grep keystone
Openstack安装与部署:nova服务的安装与配置
配置VNC信息
#openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.20.0.10
#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 10.20.0.10
#openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 10.20.0.10

#cat /etc/nova/nova.conf |grep 10.20.0.10
Openstack安装与部署:nova服务的安装与配置
#yum list | grep websockify
#yum downgrade python-websockify-0.5.1-1.el6.noarch

查看python-websockify版本,如果高于0.5对该软件降级。

配置glance连接
#openstack-config --set /etc/nova/nova.conf glance host controller0
#cat /etc/nova/nova.conf |grep controller0

Openstack安装与部署:nova服务的安装与配置
开启debug日志
#openstack-config --set /etc/nova/nova.conf DEFAULT debug True
创建nova所需的表
#su -s /bin/sh -c “nova-manage db sync” nova
#mysql -unova -p NOVA_DBPASS -e ‘show tables from nova;’

Openstack安装与部署:nova服务的安装与配置
启动nova相关服务并设开机自启
#service openstack-nova-api start
#chkconfig openstack-nova-api on
#service openstack-nova-scheduler start
#chkconfig openstack-nova-scheduler on
#service openstack-nova-cert start
#chkconfig openstack-nova-cert on
#service openstack-nova-consoleauth start
#chkconfig openstack-nova-consoleauth on
#service openstack-nova-conductor start
#chkconfig openstack-nova-conductor on
#service openstack-nova-novncproxy start
#chkconfig openstack-nova-novncproxy on

#source admin-openrc.sh
#nova service-list

Openstack安装与部署:nova服务的安装与配置