OpenStack Queens三节点从零部署-安装部署Nova(二)

最后修改时间:2018年6月26日

文档版本:1.0

本操作在控制节点上完成

三. 安装nova服务软件包

root@controller:~(keystone)# apt-get -y install nova-api nova-placement-api nova-conductor nova-consoleauth nova-scheduler nova-novncproxy python-novaclient

四. 配置nova

# 由于官方配置文件修改较为麻烦,这里直接创建一个新的配置文件
root@controller:~(keystone)# mv /etc/nova/nova.conf /etc/nova/nova.conf.org
root@controller:~(keystone)# vim /etc/nova/nova.conf
 
[DEFAULT]
# 设置控制节点IP
my_ip = 192.168.0.10
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
# 消息队列连接设置
transport_url = rabbit://openstack:root@controller

[api]
auth_strategy = keystone

# Glance连接设置
[glance]
api_servers = http://controller:9292

[oslo_concurrency]
lock_path = $state_path/tmp

# 数据库连接设置
[api_database]
connection = mysql+pymysql://nova:root@controller/nova_api

[database]
connection = mysql+pymysql://nova:root@controller/nova

# Keystone连接设置
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = root

# Placement连接设置,所有节点的配置必须相同,否则会出现错误
[placement]
auth_url = http://controller:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = root

[placement_database]
connection = mysql+pymysql://nova:root@controller/nova_placement

[wsgi]
api_paste_config = /etc/nova/api-paste.ini
 
# 因为配置文件是新建的,这里把权限加回去
root@controller:~(keystone)# chmod 640 /etc/nova/nova.conf
root@controller:~(keystone)# chgrp nova /etc/nova/nova.conf

五. 同步数据库

root@controller:~(keystone)# su -s /bin/bash nova -c "nova-manage api_db sync"
 
root@controller:~(keystone)# su -s /bin/bash nova -c "nova-manage cell_v2 map_cell0"
 
root@controller:~(keystone)# su -s /bin/bash nova -c "nova-manage db sync"
 
root@controller:~(keystone)# su -s /bin/bash nova -c "nova-manage cell_v2 create_cell --name cell1"
 
# 重启Apache2服务
root@controller:~(keystone)# systemctl restart apache2
 
# 重启nova相关服务
root@controller:~(keystone)# for service in api conductor scheduler consoleauth novncproxy; do
systemctl restart nova-$service
done
 
# 查看nova服务状态
root@controller:~(keystone)# openstack compute service list
+----+---------------+---------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  1 | nova-scheduler   | controller | internal | enabled | up    | 2018-06-26T10:13:12.000000 |
|  2 | nova-consoleauth | controller | internal | enabled | up    | 2018-06-26T10:13:12.000000 |
|  3 | nova-conductor   | controller | internal | enabled | up    | 2018-06-26T10:13:12.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
Leave a Reply