(1)安装和配置nova的compute节点
1).在comput1服务器上安装软件包yum -y install openstack-nova-compute
2).编辑/etc/nova/nova.conf
[DEFAULT]
enabled_apis =osapi_compute,metadata
transport_url =rabbit://openstack:[email protected]:5672
my_ip =172.16.70.221
use_neutron =true
firewall_driver =nova.virt.firewall.NoopFirewallDriver
[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 = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://172.16.70.206:6080/vnc_auto.html
[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
退出编辑,检查一下硬件CPU和VWARE支不支持虚拟化。可以分别调整,去服务器BIOS设置,去VWARE CPU选项中设置:
[email protected]ompute1 nova]# egrep -c '(vmx|svm)' /proc/cpuinfo
0 #0 表示不支持kvm,1 表示支持kvm。
首先,在物理机BIOS中开启虚拟化功能,然后设置VWARE虚拟机
设置完后,再查看
egrep -c '(vmx|svm)' /proc/cpuinfo 返回0,表示不支持,其它都表示支持,支持就不需要配置libvirt中的选项,否则如下:
virt_type=qemu
cpu_mode =none
(2)设置服务开机启动
systemctl enable libvirtd.service
systemctl enable openstack-nova-compute.service
systemctl start libvirtd.service
systemctl start openstack-nova-compute.service
(3)获取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 #在后面加上这一条
也可以在controller1服务器复制过来:scp ~/admin-openrc [email protected]:/root/
(4)注册一个计算节点
每增加一个计算节点都要执行这个注册
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
可以设为5秒,自动注册
vim /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval=300
(5)如果nova-compute服务无法启动,请检查/var/log/nova/nova-compute.log
本人在这出现过以下几次问题导致无法启动,在这分享一下决解办法
(1)oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/
May 17 14:00:27 compute1 systemd[1]: openstack-nova-compute.service: main process exited, code=exited, status=1/FAILURE
May 17 14:00:27 compute1 systemd[1]: Failed to start OpenStack Nova Compute Server.
这个问题是/etc/nova/nova.conf配置文件权限不够。#chown root:nova /etc/nova/nova.conf 改变权限即可。
[[email protected] nova]# ll /etc/nova/nova.conf
-rw-r----- 1 root nova 363538 Apr 30 19:51 /etc/nova/nova.conf
(2)2018-05-17 11:20:56.354 51877 ERROR oslo.messaging._drivers.impl_rabbit [req-001b5e3a-57ab-4fa4-b9e9-c717d48fdce6 - - - - -] [6096047e-03a3-468f-a509-da8faa57c7ca] AMQP server on 127.0.0.1:5672 is unreachable: [Errno 111] ECONNREFUSED. Trying again in 32 seconds. Client port: None: error: [Errno 111] ECONNREFUSED
这个问题更了好我贴子,有的说是防火墙,有的说是iptables等等阻档了访问rabbitmq,但是我在compute1计算节点用telnet 172.16.70.202 5672试过,没有问题可以访问,selinux ,firewalld ,iptables都已关闭。virt_type=qemu
(3)2018-05-17 17:35:51.990 2873 ERROR nova ConfigFileValueError: Value for option cpu_mode is not valid: Valid values are [host-model, host-passthrough, custom, none], but found 'None'
2018-05-17 17:35:51.990 2873 ERROR nova
在nova.conf文件中有一项是#cpu_mod=<none> ,这项不要打开注释
--------以下是做了修改并且可以正常运行的nova.conf文件------
[[email protected] ~]# grep '^[a-Z]' /etc/nova/nova.conf
enabled_apis =osapi_compute,metadata
my_ip =172.16.70.221
use_neutron =true
firewall_driver =nova.virt.firewall.NoopFirewallDriver
transport_url=rabbit://openstack:[email protected]:5672
auth_strategy = keystone
api_servers = http://172.16.70.205:9292
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
lock_path=/var/lib/nova/tmp
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
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = 172.16.70.221
novncproxy_base_url = http://172.16.70.206:6080/vnc_auto.html
(6)分别在nova控制节点和计算节点验证
1).列出服务组件
# openstack compute service list
2).列出目前所安装的全部服务的API端点:
# openstack catalog list
3).列出镜像
# openstack image list
4)在nova1控制节点上,检查cells和placement API是否正常
# nova-status upgrade check
错误,需要执行:nova-manage cell_v2 simple_cell_setup
安装三个计算节点后的列表: