(1)在mariadb上为nova控制节点创建管理数据库并授权
mysql -u root -p
CREATE DATABASE nova;CREATE DATABASE nova_api;
CREATE DATABASE nova_cell0;
CREATE DATABASE nova_placement;
进入数据库后,执行:
flush privileges;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
用合适的密码替换NOVA_DBPASS.
(2)获取admin用户的环境变量
创建admin-openrc脚本,vim /root/admin-openrc
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_AUTH_URL=http://172.16.70.201:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
source ~/admin-openrc
vim ~/.bash_profile
source ~/admin-openrc #在后面加上这一条
(3)在keystone上创建nova服务
1)创建nova用户
[root@controller1 ~]# openstack user create --domain default --password-prompt nova
User Password:123456
2)添加用户角色,给nova用户添加admin权限
[root@controller1 ~]#openstack role add --project service --user nova admin
说明:此条命令执行成功后不返回参数
3)创建名称为nova的计算服务
[root@controller1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
4)创建计算服务三个nova API服务端点public,internal,admin
1.public API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne compute public http://172.16.70.206:8774/v2.1
2.internal API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne compute internal http://172.16.70.206:8774/v2.1
3.admin API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne compute admin http://172.16.70.206:8774/v2.1
(4)在keystone上创建placement服务
1)创建placement服务用户
[root@controller1 ~]# openstack user create --domain default --password-prompt placement
User Password:123456
2)添加用户角色,给placement用户添加admin权限
[root@controller1 ~]#openstack role add --project service --user placement admin
说明:此条命令执行成功后不返回参数
3)创建Placement API服务
[root@controller1 ~]# openstack service create --name placement --description "Placement API" placement
4)创建三个Placement API服务端点public,internal,admin
1.public API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne placement public http://172.16.70.206:8778
2.internal API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne placement internal http://172.16.70.206:8778
3.admin API端点
[root@controller1 ~]# openstack endpoint create --region RegionOne placement admin http://172.16.70.206:8778
(4)在nova1服务器上安装并配置nova
1)安装nova控制节点相关组件
yum -y install openstack-nova-api
yum -y install openstack-nova-conductor
yum -y install openstack-nova-console
yum -y install openstack-nova-novncproxy
yum -y install openstack-nova-scheduler
yum -y install openstack-nova-placement-api
2)编辑/etc/nova/nova.conf参数
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@172.16.70.202
my_ip = 172.16.70.206
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:NOVA_DBPASS@172.16.70.203/nova_api
[database]
connection = mysql+pymysql://nova:NOVA_DBPASS@172.16.70.203/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://172.16.70.201:5000
auth_url = http://172.16.70.201:35357
memcached_servers = 172.16.70.204:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123456
[vnc]
enabled = true
server_listen = 172.16.70.206 #$my_ip
server_proxyclient_address = 172.16.70.206 #$my_ip
[glance]
api_servers = http://172.16.70.205: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://172.16.70.201:35357/v3
username = placement
password = 123456
3)检查/etc/nova/nova.conf配置
4)编辑/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>
(5)安装Apache HTTP服务
yum -y install httpd
systemctl enable httpd
systemctl restart httpd
netstat -ntlp
(6)同步nova相关数据库并启动nova服务
1).同步数据库
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数据库用户账号,在前面的创建数据库和授权中,已创建该账号。同步过程中没有出现错误。
有一个警告:Configuration option(s) ['use_tpool'] not supported
[root@nova1 ~]# nova-manage cell_v2 list_cells
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
这个可以忽略
2).查看
nova-manage cell_v2 list_cells![](https://i-blog.csdnimg.cn/blog_migrate/755fc4162d1bb9b51bb19c482b710359.png)
3).启动nova相关服务
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
查看一下服务启动
systemctl status openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service