openstack 调整云主机大小

Posted blog-lhong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack 调整云主机大小相关的知识,希望对你有一定的参考价值。

openstack 调整云主机大小 

######在主控制节点和所有的计算机节点做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 
scheduler_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

 

以上是关于openstack 调整云主机大小的主要内容,如果未能解决你的问题,请参考以下文章

在OpenStack中对云主机类型进行重新配置

openstack名词解释

中小企业openstack私有云布署实践11.3 计算nova - compute节点-nova用户免密登录(用于云主机冷迁移+扩展云主机大小)

使用Redhat OpenStack发放云主机

使用Redhat OpenStack发放云主机

使用Redhat OpenStack发放云主机