OpenStack Queens三节点从零部署-安装部署Nova计算节点

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

文档版本:1.0

本操作通常在计算节点上完成,除非是all in one

一. 安装nova-kvm软件包

root@compute:~# apt-get -y install nova-compute-kvm

二. 修改nova配置文件

# 由于官方配置文件修改较为麻烦,这里直接创建一个新的配置文件
root@compute:~# mv /etc/nova/nova.conf /etc/nova/nova.conf.org
root@compute:~# vim /etc/nova/nova.conf
 
[DEFAULT]
# 设置计算节点IP
my_ip = 192.168.0.30
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

# 启用VNC
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

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

[oslo_concurrency]
lock_path = $state_path/tmp

# 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

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

三. 检查虚拟化开启状态

# 检查虚拟化是否开启,如返回非0则为开启
root@compute:~# egrep -c '(vmx|svm)' /proc/cpuinfo
1
 
⚠ 如果上面命令执行结果不为0,则跳过这一步,如果为0,则需要执行下面这一步
root@compute:~# vim /etc/nova/nova-compute.conf
# 找到[libvirt]这一项,将其中的virt_type修改为以下样式,没有这一项则手动添加
 
[libvirt]
virt_type = qemu

四. 同步数据库并查看服务列表

# 注意本操作在控制节点上运行
root@controller:~# su -s /bin/bash nova -c "nova-manage cell_v2 discover_hosts"
 
# 查看nova服务状态
root@controller:~# openstack compute service list
+----+------------+------------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  1 | nova-scheduler   | controller | internal | enabled | up    | 2018-06-27T10:24:10.000000 |
|  2 | nova-consoleauth | controller | internal | enabled | up    | 2018-06-27T10:24:12.000000 |
|  3 | nova-conductor   | controller | internal | enabled | up    | 2018-06-27T10:24:13.000000 |
|  7 | nova-compute     | compute    | nova     | enabled | up    | 2018-06-27T10:24:20.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
Leave a Reply