一、创建数据库(控制节点)
创建数据库以及用户:
# mysql -uroot -p12345678
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 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
二、创建nova认证相关信息(控制节点)
用admin用户凭证创建nova用户凭证:
# source admin-openrc
# openstack user create --domain default --password-prompt nova #设置密码nova123
给nova用户添加admin角色:
# openstack role add --project service --user nova admin
创建nova服务:
# openstack service create --name nova --description "OpenStack Compute" compute
创建计算api端口
# openstack endpoint create --region RegionOne compute public http://10.10.11.11:8774/v2.1
# openstack endpoint create --region RegionOne compute internal http://10.10.11.11:8774/v2.1
# openstack endpoint create --region RegionOne compute admin http://10.10.11.11:8774/v2.1
创建placement服务用户
# openstack user create --domain default --password-prompt placement #密码设置的placement123
添加placement用户到服务项目
# openstack role add --project service --user placement admin
创建placement api服务
# openstack service create --name placement --description "Placement API" placement
创建placement api服务端口
# openstack endpoint create --region RegionOne placement public http://10.10.11.11:8778
# openstack endpoint create --region RegionOne placement internal http://10.10.11.11:8778
# openstack endpoint create --region RegionOne placement admin http://10.10.11.11:8778
三、安装软件包并配置组件(控制节点)
3.1 控制节点安装服务
# yum install openstack-nova-api openstack-nova-conductor
openstack-nova-console openstack-nova-novncproxy
openstack-nova-scheduler openstack-nova-placement-api -y
3.2 编辑/etc/nova/nova.conf文件并完成以下配置
[DEFAULT]
enabled_apis = osapi_compute,metadata
my_ip = 10.10.11.11
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
transport_url = rabbit://openstack:openstack123@10.10.11.11
[api_database]
connection = mysql+pymysql://nova:nova123@localhost/nova_api
[database]
connection = mysql+pymysql://nova:nova123@localhost/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://10.10.11.11:5000
auth_url = http://10.10.11.11:35357
memcached_servers = 10.10.11.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova123
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
[glance]
api_servers = http://10.10.11.11: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://10.10.11.11:35357/v3
username = placement
password = placement123
因为软件包的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>
重启httpd服务
# systemctl restart httpd
同步api数据库
# su -s /bin/sh -c "nova-manage api_db sync" nova
同步cell0数据库:
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
创建cell1:
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
同步nova数据库:(时间比较久,不要动)
# su -s /bin/sh -c "nova-manage db sync" 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