私有云落地解决方案之openstack高可用(pike版本)-添加计算节点

时间:2021-02-07 17:15:12

作者:【吴业亮】

博客:http://blog.csdn.net/wylfengyujiancheng

Nova
安装软件包

# yum install openstack-nova-compute -y

修改配置文件/etc/nova/nova.conf

[DEFAULT]
enabled_apis = osapi_compute,metadata
firewall_driver = nova.virt.firewall.NoopFirewallDriver
my_ip = 172.16.8.63
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
vif_plugging_is_fatal = True
vif_plugging_timeout = 300
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
[api]
auth_strategy = keystone
[api_database]
[barbican]
[cache]
[cells]
[cinder]
os_region_name = RegionOne
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[crypto]
[database]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://172.16.8.50:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone_authtoken]
auth_uri = http://172.16.8.50:5000
auth_url = http://172.16.8.50:36357
memcached_servers = node1:11211,node2:11211,node3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = Changeme_123
[libvirt]
virt_type = qemu
cpu_mode=none
[matchmaker_redis]
[metrics]
[mks]
[neutron]
url = http://172.16.8.50:9696
auth_url = http://172.16.8.50:36357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = Changeme_123
service_metadata_proxy = True
metadata_proxy_shared_secret = Changeme_123
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
rabbit_hosts = node1:5672,node2:5672,node3:5672
rabbit_userid = openstack
rabbit_password = Changeme_123
rabbit_ha_queues = True
rabbit_retry_interval = 1
rabbit_retry_backoff = 2
rabbit_max_retries = 0
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://172.16.8.50:36357/v3
username = placement
password = Changeme_123
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[trusted_computing]
[upgrade_levels]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://172.16.8.50:6080/vnc_auto.html
[workarounds]
[wsgi]
[xenserver]
[xvp]

检测是否支持虚拟化

# egrep -c '(vmx|svm)' /proc/cpuinfo

无回显用qemu,有回显用kvm

[libvirt]
# ...
virt_type = qemu
cpu_mode=none

启动服务并设置开机启动

# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service

验证

# openstack compute service list --service nova-compute

任一控制节点上
发现计算节点

# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

如果配置自动发现

[scheduler]
discover_hosts_in_cells_interval = 300

验证

查看服务

# openstack compute service list

在Identity Service中列出API的endpoint,以验证与Identity服务的连接正常

# openstack catalog list

查看镜像服务

# openstack image list

验证cells and placement API 是否正常

# nova-status upgrade check

Neutron

安装软件包

# yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch

修改配置文件

# mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org 
# vi /etc/neutron/neutron.conf
[DEFAULT]
core_plugin = ml2
service_plugins = router
auth_strategy = keystone
state_path = /var/lib/neutron
allow_overlapping_ips = True
# RabbitMQ connection info
transport_url = rabbit://openstack:Changeme_123@172.16.8.50

# Keystone auth info
[keystone_authtoken]
auth_uri = http://172.16.8.50:5000
auth_url = http://172.16.8.50:35357
memcached_servers = node1:11211,node2:11211,node3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = Changeme_123

[oslo_concurrency]
lock_path = $state_path/lock

修改权限

# chmod 640 /etc/neutron/neutron.conf 
# chgrp neutron /etc/neutron/neutron.conf

修改配置文件/etc/neutron/plugins/ml2/ml2_conf.ini

# cp -a /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini_bak
openstack-config --set   /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers  flat,vlan,gre,vxlan 
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers openvswitch,l2population
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_security_group True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset True

修改配置文件/etc/nova/nova.conf

openstack-config --set   /etc/nova/nova.conf  DEFAULT  vif_plugging_is_fatal  True
openstack-config --set /etc/nova/nova.conf DEFAULT vif_plugging_timeout 300
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver nova.network.linux_net.LinuxOVSInterfaceDriver
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf neutron url http://172.16.8.50:9696
openstack-config --set /etc/nova/nova.conf neutron auth_url http://172.16.8.50:35357
openstack-config --set /etc/nova/nova.conf neutron auth_type password
openstack-config --set /etc/nova/nova.conf neutron project_domain_name default
openstack-config --set /etc/nova/nova.conf neutron user_domain_name default
openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne
openstack-config --set /etc/nova/nova.conf neutron project_name service
openstack-config --set /etc/nova/nova.conf neutron username neutron
openstack-config --set /etc/nova/nova.conf neutron password Changeme_123
openstack-config --set /etc/nova/nova.conf neutron service_metadata_proxy True
openstack-config --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret Changeme_123

创建软连接

# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini 

启动服务

# systemctl start openvswitch 
# systemctl enable openvswitch 

创建网桥

# ovs-vsctl add-br br-int 

启动服务

# systemctl restart openstack-nova-compute 
# systemctl start neutron-openvswitch-agent 
# systemctl enable neutron-openvswitch-agent