[关闭]
@Alex-Zhao 2018-06-01T12:13:41.000000Z 字数 8292 阅读 568

OpenStack扩容计算节点

OpenStack


扩容计算节点本文从安装OpenStack开始,相关基础配置不再说明
(基础配置有网卡名称顺序、IP地址、DNS地址、hosts文件、时间同步可以选择ntp或者chrony、主机名、时间配置、系统是否升级最新版、关闭iptables、关闭SELinux、xorg-x11-xauth、net-tools)

  1. yum install centos-release-openstack-newton openstack-utils -y
  2. yum install openstack-selinux
  3. yum install python-openstackclient -y #为了调试方便我会安装openstack的client程序
  1. yum install openstack-nova-compute -y
  1. yum install openstack-neutron-linuxbridge ebtables ipset -y
  1. cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
  2. cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
  3. cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
  4. cat /etc/nova/nova.conf.bak | egrep -v "^$|^#" > /etc/nova/nova.conf
  5. cat /etc/neutron/neutron.conf.bak | egrep -v "^$|^#" > /etc/neutron/neutron.conf
  6. cat /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak | egrep -v "^$|^#" > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
  1. openstack-config --set /etc/nova/nova.conf DEFAULT enalbe_apis osapi_compute,metadata
  2. openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:PASSWORD@rabbitmq:5672
  3. openstack-config --set /etc/nova/nova.conf DEFAULT my_ip xx.xxx.xxx.xxx #当前节点IP
  4. openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
  5. openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
  6. openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
  7. openstack-config --set /etc/nova/nova.conf DEFAULT compute_driver libvirt.LibvirtDriver
  8. openstack-config --set /etc/nova/nova.conf DEFAULT block_device_allocate_retries 60
  9. openstack-config --set /etc/nova/nova.conf DEFAULT block_device_allocate_retries_interval 3
  10. openstack-config --set /etc/nova/nova.conf DEFAULT cpu_allocation_ratio 8.0
  11. openstack-config --set /etc/nova/nova.conf DEFAULT ram_allocation_ratio 1.0
  12. openstack-config --set /etc/nova/nova.conf cache enabled true
  13. openstack-config --set /etc/nova/nova.conf cache backend oslo_cache.memcache_pool
  14. openstack-config --set /etc/nova/nova.conf cache memcache_servers "controller1:11211,controller2:11211,controller3:11211"
  15. openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
  16. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
  17. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:35357
  18. openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
  19. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default
  20. openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default
  21. openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
  22. openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
  23. openstack-config --set /etc/nova/nova.conf keystone_authtoken password PASSWORD
  24. openstack-config --set /etc/nova/nova.conf libvirt images_type rbd #如果使用CEPH存储写rbd
  25. openstack-config --set /etc/nova/nova.conf libvirt images_rbd_pool vms #CEPH存储pool名称
  26. openstack-config --set /etc/nova/nova.conf libvirt images_rbd_ceph_conf /etc/ceph/ceph.conf #ceph配置文件所在位置
  27. openstack-config --set /etc/nova/nova.conf libvirt rbd_user cinder #ceph存储使用的用户名称
  28. openstack-config --set /etc/nova/nova.conf libvirt rbd_secret_uuid 1ab5f758-7908-4d84-a329-1cf1b7fedd51 #ceph的秘钥uuid
  29. openstack-config --set /etc/nova/nova.conf libvirt disk_cachemodes "network=writeback"
  30. openstack-config --set /etc/nova/nova.conf libvirt inject_password false
  31. openstack-config --set /etc/nova/nova.conf libvirt inject_key false
  32. openstack-config --set /etc/nova/nova.conf libvirt inject_partition -2
  33. openstack-config --set /etc/nova/nova.conf libvirt hw_disk_discard unmap
  34. openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm #虚拟化类型qemu,kvm,vmware,xen
  35. openstack-config --set /etc/nova/nova.conf libvirt cpu_mode custom #KVM的CPU模式,custom对于迁移来讲兼容性最好,性能最差。
  36. openstack-config --set /etc/nova/nova.conf libvirt cpu_model Westmere #指定虚拟机运行的CPU指令集
  37. openstack-config --set /etc/nova/nova.conf libvirt live_migration_inbound_addr compute156 #当前节点的主机名或者IP
  38. openstack-config --set /etc/nova/nova.conf neutron url http://controller:9696
  39. openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:35357
  40. openstack-config --set /etc/nova/nova.conf neutron auth_type password
  41. openstack-config --set /etc/nova/nova.conf neutron project_domain_name Default
  42. openstack-config --set /etc/nova/nova.conf neutron user_domain_name Default
  43. openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne
  44. openstack-config --set /etc/nova/nova.conf neutron project_name service
  45. openstack-config --set /etc/nova/nova.conf neutron username neutron
  46. openstack-config --set /etc/nova/nova.conf neutron password PASSWORD
  47. openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
  48. openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_interval 1
  49. openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_backoff 2
  50. openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_durable_queues true
  51. openstack-config --set /etc/nova/nova.conf vnc enabled True
  52. openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
  53. openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address \$my_ip #注意这里可能会出现传入的是变量
  54. openstack-config --set /etc/nova/nova.conf vnc novncproxy_host \$my_ip
  55. openstack-config --set /etc/nova/nova.conf vnc novncproxy_port 5554
  56. openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://<IP>:6080/vnc_auto.html #<IP>控制节点IP
  1. openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
  2. openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:PASSWORD@rabbitmq:5672
  3. openstack-config --set /etc/neutron/neutron.conf DEFAULT report_interval 15
  4. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_uri http://controller:5000
  5. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:35357
  6. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password
  7. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name Default
  8. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name Default
  9. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service
  10. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron
  11. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password PASSWORD
  12. openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp
  13. openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_retry_interval 1
  14. openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_retry_backoff 2
  15. openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_durable_queues true
  16. #以下配置使用neutron中默认的linuxbridge的flat-vlan模式,如有不同请注意一下
  17. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vlans tenant_network_type vlan
  18. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vlans network_vlan_ranges provider:1:4094
  19. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:PHY-NETWORK-NAME #虚拟机通信使用的网卡名称
  20. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group True
  21. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
  22. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan False
  1. yum install ceph-common libvirt -y
  1. systemctl start libvirtd
  1. sed -i 's/^#listen_tls = 0/listen_tls = 0/' /etc/libvirt/libvirtd.conf
  2. sed -i 's/^#listen_tcp = 1/listen_tcp = 1/' /etc/libvirt/libvirtd.conf
  3. sed -i 's/^#auth_tcp = \"sasl\"/auth_tcp = \"none\"/' /etc/libvirt/libvirtd.conf
  4. vi /etc/sysconfig/libvirtd
  5. LIBVIRTD_ARGS="--listen"

验证在线迁移是否可行

  1. virsh -c qemu+tcp://root@192.168.1.26:16509/system
  1. virsh secret-define --file secret.xml
  2. id=$(cat ceph.client.cinder.keyring | grep key | awk '{print $3}')
  3. virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 $id

PS:配置参考ceph文档

  1. systemctl enable libvirtd.service openstack-nova-compute.service neutron-linuxbridge-agent
  2. systemctl start libvirtd.service openstack-nova-compute.service neutron-linuxbridge-agent
  1. [root@controller1 ~]# openstack compute service list #所有的计算节点都是UP的状态表示加入成功
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注