@Alex-Zhao
2018-06-01T12:13:41.000000Z
字数 8292
阅读 568
OpenStack
扩容计算节点本文从安装OpenStack开始,相关基础配置不再说明
(基础配置有网卡名称顺序、IP地址、DNS地址、hosts文件、时间同步可以选择ntp或者chrony、主机名、时间配置、系统是否升级最新版、关闭iptables、关闭SELinux、xorg-x11-xauth、net-tools)
yum install centos-release-openstack-newton openstack-utils -y
yum install openstack-selinux
yum install python-openstackclient -y #为了调试方便我会安装openstack的client程序
yum install openstack-nova-compute -y
yum install openstack-neutron-linuxbridge ebtables ipset -y
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
cat /etc/nova/nova.conf.bak | egrep -v "^$|^#" > /etc/nova/nova.conf
cat /etc/neutron/neutron.conf.bak | egrep -v "^$|^#" > /etc/neutron/neutron.conf
cat /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak | egrep -v "^$|^#" > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
openstack-config --set /etc/nova/nova.conf DEFAULT enalbe_apis osapi_compute,metadata
openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:PASSWORD@rabbitmq:5672
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip xx.xxx.xxx.xxx #当前节点IP
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT compute_driver libvirt.LibvirtDriver
openstack-config --set /etc/nova/nova.conf DEFAULT block_device_allocate_retries 60
openstack-config --set /etc/nova/nova.conf DEFAULT block_device_allocate_retries_interval 3
openstack-config --set /etc/nova/nova.conf DEFAULT cpu_allocation_ratio 8.0
openstack-config --set /etc/nova/nova.conf DEFAULT ram_allocation_ratio 1.0
openstack-config --set /etc/nova/nova.conf cache enabled true
openstack-config --set /etc/nova/nova.conf cache backend oslo_cache.memcache_pool
openstack-config --set /etc/nova/nova.conf cache memcache_servers "controller1:11211,controller2:11211,controller3:11211"
openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password PASSWORD
openstack-config --set /etc/nova/nova.conf libvirt images_type rbd #如果使用CEPH存储写rbd
openstack-config --set /etc/nova/nova.conf libvirt images_rbd_pool vms #CEPH存储pool名称
openstack-config --set /etc/nova/nova.conf libvirt images_rbd_ceph_conf /etc/ceph/ceph.conf #ceph配置文件所在位置
openstack-config --set /etc/nova/nova.conf libvirt rbd_user cinder #ceph存储使用的用户名称
openstack-config --set /etc/nova/nova.conf libvirt rbd_secret_uuid 1ab5f758-7908-4d84-a329-1cf1b7fedd51 #ceph的秘钥uuid
openstack-config --set /etc/nova/nova.conf libvirt disk_cachemodes "network=writeback"
openstack-config --set /etc/nova/nova.conf libvirt inject_password false
openstack-config --set /etc/nova/nova.conf libvirt inject_key false
openstack-config --set /etc/nova/nova.conf libvirt inject_partition -2
openstack-config --set /etc/nova/nova.conf libvirt hw_disk_discard unmap
openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm #虚拟化类型qemu,kvm,vmware,xen
openstack-config --set /etc/nova/nova.conf libvirt cpu_mode custom #KVM的CPU模式,custom对于迁移来讲兼容性最好,性能最差。
openstack-config --set /etc/nova/nova.conf libvirt cpu_model Westmere #指定虚拟机运行的CPU指令集
openstack-config --set /etc/nova/nova.conf libvirt live_migration_inbound_addr compute156 #当前节点的主机名或者IP
openstack-config --set /etc/nova/nova.conf neutron url http://controller:9696
openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller: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 PASSWORD
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_interval 1
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_backoff 2
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_durable_queues true
openstack-config --set /etc/nova/nova.conf vnc enabled True
openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address \$my_ip #注意这里可能会出现传入的是变量
openstack-config --set /etc/nova/nova.conf vnc novncproxy_host \$my_ip
openstack-config --set /etc/nova/nova.conf vnc novncproxy_port 5554
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://<IP>:6080/vnc_auto.html #<IP>控制节点IP
openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:PASSWORD@rabbitmq:5672
openstack-config --set /etc/neutron/neutron.conf DEFAULT report_interval 15
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password PASSWORD
openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_retry_interval 1
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_retry_backoff 2
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_durable_queues true
#以下配置使用neutron中默认的linuxbridge的flat-vlan模式,如有不同请注意一下
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vlans tenant_network_type vlan
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vlans network_vlan_ranges provider:1:4094
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:PHY-NETWORK-NAME #虚拟机通信使用的网卡名称
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group True
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan False
yum install ceph-common libvirt -y
systemctl start libvirtd
sed -i 's/^#listen_tls = 0/listen_tls = 0/' /etc/libvirt/libvirtd.conf
sed -i 's/^#listen_tcp = 1/listen_tcp = 1/' /etc/libvirt/libvirtd.conf
sed -i 's/^#auth_tcp = \"sasl\"/auth_tcp = \"none\"/' /etc/libvirt/libvirtd.conf
vi /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"
验证在线迁移是否可行
virsh -c qemu+tcp://root@192.168.1.26:16509/system
virsh secret-define --file secret.xml
id=$(cat ceph.client.cinder.keyring | grep key | awk '{print $3}')
virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 $id
PS:配置参考ceph文档
systemctl enable libvirtd.service openstack-nova-compute.service neutron-linuxbridge-agent
systemctl start libvirtd.service openstack-nova-compute.service neutron-linuxbridge-agent
[root@controller1 ~]# openstack compute service list #所有的计算节点都是UP的状态表示加入成功