openstack 調整雲主機大小 node
######在主控制節點和全部的計算機節點作ssh認證 [ ! -f sshkey_tool.sh ] && wget https://files.cnblogs.com/files/blog-lhong/sshkey_tool.sh bash sshkey_tool.sh node171 root ess.com1 bash sshkey_tool.sh node172 root ess.com1 bash sshkey_tool.sh node173 root ess.com1 bash sshkey_tool.sh node174 root ess.com1 bash sshkey_tool.sh controller root ess.com1 ######生成sshkey和配置ssh ########主控制節點和全部的計算機節點 usermod -s /bin/bash nova su nova -c " cd /tmp yes |ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa yes |ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa echo ' Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null ' >>~/.ssh/config ls -l ~/.ssh/id* " ###########上面的命令也能夠經過sshkey來操做 ssh node172 "usermod -s /bin/bash nova su nova -c \" cd /tmp yes |ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa yes |ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa echo ' Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null ' >>~/.ssh/config \" ls -l /var/lib/nova/.ssh/id* " ssh node173 "usermod -s /bin/bash nova su nova -c \" cd /tmp yes |ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa yes |ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa echo ' Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null ' >>~/.ssh/config \" ls -l /var/lib/nova/.ssh/id* " ssh node174 "usermod -s /bin/bash nova su nova -c \" cd /tmp yes |ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa yes |ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa echo ' Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null ' >>~/.ssh/config \" ls -l /var/lib/nova/.ssh/id* " ######################把每個節點的公鑰寫入authorized_keys文件 ssh node171 "su nova -c 'cat /var/lib/nova/.ssh/id_rsa.pub >/var/lib/nova/.ssh/authorized_keys'" ssh node171 "su nova -c 'cat /var/lib/nova/.ssh/id_dsa.pub >>/var/lib/nova/.ssh/authorized_keys'" cat /var/lib/nova/.ssh/authorized_keys ll /var/lib/nova/.ssh/authorized_keys ssh node172 'su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys ssh node172 'su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys cat /var/lib/nova/.ssh/authorized_keys ll /var/lib/nova/.ssh/authorized_keys ssh node173 'su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys ssh node173 'su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys cat /var/lib/nova/.ssh/authorized_keys ll /var/lib/nova/.ssh/authorized_keys ssh node174 'su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys cat /var/lib/nova/.ssh/authorized_keys ll /var/lib/nova/.ssh/authorized_keys ssh node174 'su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub" ' >>/var/lib/nova/.ssh/authorized_keys cat /var/lib/nova/.ssh/authorized_keys ll /var/lib/nova/.ssh/authorized_keys chmod 644 /var/lib/nova/.ssh/authorized_keys chown nova.nova /var/lib/nova/.ssh/authorized_keys ################ ###下發authorized_keys文件到每個節點 rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node172:/var/lib/nova/.ssh/ rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node173:/var/lib/nova/.ssh/ rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node174:/var/lib/nova/.ssh/ ############################## #### #sed -i '/\[DEFAULT\]/ a allow_resize_to_same_host=True \nscheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter' /etc/nova/nova.conf #head /etc/nova/nova.conf #####在controller節點上重啓nova服務 #systemctl restart openstack-nova-api.service openstack-nova-conductor.service openstack-nova-scheduler.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-compute.service openstack-nova-novncproxy.service ###在各個計算節點上重啓nova服務 #service openstack-nova-compute restart